Doped, substituted, or alloyed graphene is an attractive candidate for use as a tunable element of future nanomechanical and optoelectronic devices. Here we use the density functional theory, density functional tight binding, cluster expansion, and molecular dynamics to investigate the thermal stability and electronic properties of a binary 2D alloy of graphitic carbon and nitrogen (C(1-x)N(x)). The stability range naturally begins from graphene and must end before x = 1, where pure nitrogen rather forms molecular gas. This poses a compelling question of what highest x < 1 still permits stable 2D hexagonal lattice. Such upper limit on the nitrogen concentration that is achievable in a stable alloy can be found based on the phonon and molecular dynamics calculations. The stability switchover is predicted to between x = 1/3 (33.3%) and x = 3/8 (37.5%), and no stable hexagonal lattice two-dimensional CN alloys can exist at the N concentration of x = 3/8 (37.5%) and higher.