Compounds consisting only of the element nitrogen (polynitrogens or nitrogen allotropes) are considered promising clean energy-storage materials owing to their immense energy content that is much higher than hydrogen, ammonia or hydrazine, which are in common use, and because they release only harmless nitrogen on decomposition1. However, their extreme instability poses a substantial synthetic challenge and no neutral molecular nitrogen allotrope beyond N2 has been isolated2,3. Here we present the room-temperature preparation of molecular N6 (hexanitrogen) through the gas-phase reaction of chlorine or bromine with silver azide, followed by trapping in argon matrices at 10 K. We also prepared neat N6 as a film at liquid nitrogen temperature (77 K), further indicating its stability. Infrared and ultraviolet–visible (UV-Vis) spectroscopy, 15N-isotope labelling and ab initio computations firmly support our findings. The preparation of a metastable molecular nitrogen allotrope beyond N2 contributes to our fundamental scientific knowledge and possibly opens new opportunities for future energy-storage concepts.