We propose a scheme to fabricate the cobalt nitride CoN4 monolayer, a magnetic graphene-like two-dimensional material, in which all Co and N atoms are in a plane. Under the pressure above 40 GPa, the bulk CoN4 is stabilized in a triclinic phase. With the pressure decreasing, the triclinic phase of CoN4 is transformed into an orthorhombic phase, and the latter is a layered compound with large interlayer spacing. At ambient condition, the weak interlayer couplings are so small that single CoN4 layer can be exfoliated by the mechanical method.