Aerogel structures have attracted increasing research interest in energy storage and conversion owing to their unique structural features, and a variety of materials have been engineered into aerogels, including carbon-based materials, metal oxides, linear polymers and even metal chalcogenides. However, manufacture of aerogels from nitride-based materials, particularly the emerging light-weight carbon nitride (CN) semiconductors is rarely reported. Here, we develop a facile method based on self-assembly to produce self-supported CN aerogels, without using any cross-linking agents. The combination of large surface area, incorporated functional groups and three-dimensional (3D) network structure, endows the resulting freestanding aerogels with high photocatalytic activity for hydrogen evolution and H2O2 production under visible light irradiation. This work presents a simple colloid chemistry strategy to construct 3D CN aerogel networks that shows great potential for solar-to-chemical energy conversion by artificial photosynthesis.