The phase diagram and equation of state of dense nitrogen are of interest in understanding the fundamental physics and chemistry under extreme conditions, including planetary processes, and in discovering new materials. We predict several stable phases of nitrogen at multi-TPa pressures, including a P4/nbm structure consisting of partially charged N2δ+ pairs and N5δ- tetrahedra, which is stable in the range 2.5–6.8 TPa. This is followed by a modulated layered structure between 6.8 and 12.6 TPa, which also exhibits a significant charge transfer. The P4/nbm metallic nitrogen salt and the modulated structure are stable at high pressures and temperatures, and they exhibit strongly ionic features and charge density distortions, which is unexpected in an element under such extreme conditions and could represent a new class of nitrogen materials. The P-T phase diagram of nitrogen at TPa pressures is investigated using quasiharmonic phonon calculations and ab initio molecular dynamics simulations.