We systematically investigate trends in carbon nitride structures targeting the lowest energy configuration of C3N4. Layered conformations, sp2-bonded, turn out to be more favorable than denser, sp3-bonded, networks. Among layered structures, those comprising the heptazine motif are consistently lower in energy when compared to triazine-based models. Additional decrease of energy is achieved by corrugation of the layers, driven by avoiding repulsive interactions between nitrogen lone-pairs. Consequences of such curvature are for one the necessity to approximate the lowest energy configuration of C3N4 with very large unit cells, as indicated through ab-initio molecular dynamic simulations. Secondly, curvature favors the genesis of confined structures of carbon nitride: the energy difference between "one-dimensional" nanostructures and the layered state is at least smaller for C3N 4 than for pure carbon. © 2009 The Royal Society of Chemistry.