We studythe effect of shear deformation on graphitic g-C3N4 under pressures of up to 80 GPa at room temperature. g-C3N4 samples are transformed from initial amorphous flakes into onion-like structures, in which the nitrogen content in the quenched samples decreases with increasing pressure (from 42% in the initial conditions to 1% at 80 GPa). The concentration of the sp2 bonds also decreases from 1 (the initial sample) to 0.62 with increasing pressure to 80 GPa. This transformation of the sample is due to the fact that in the pressure range of 55–115 GPa, the equilibrium phase is not a diamond, but instead, carbon onions cross-linked by sp3 bonds, which are denser than diamonds. The results of our study show that the presence of nitrogen in sp3-bonded structures at pressures of higher than 55 GPa reduces the density and, accordingly, carbon structures without nitrogen become thermodynamically favorable.