Metal-free nitrogen-doped carbon is considered as a green functional material, but the structural determination of the atomic positions of nitrogen remains challenging. We recently demonstrated that directly-excited solid state <sup>15</sup>N NMR (ssNMR) spectroscopy is a powerful tool for the determination of such positions in an N-doped carbon at natural <sup>15</sup>N isotope abundance. Here we present a green chemistry approach to the synthesis of N-doped carbon using cellulose as precursor, and a study of the catalytic properties and atomic structures of the related catalyst. The N-doped carbon (NH<sub>3</sub>) was obtained by oxidation of cellulose with HNO<sub>3</sub> followed by ammonolysis at 800°C. It had a N content of 6.5 wt.% and a surface area of 557 m<sup>2 </sup>g<sup>–1</sup>, and <sup>15</sup>N ssNMR spectroscopy provided evidence for graphitic nitrogen besides of regular pyrrolic and pyridinic nitrogen. This structure determination enabled probing the role of graphitic nitrogen for electrocatalytic reactions, such as the hydrogen evolution reaction (HER), oxygen evolution reaction (OER), and nitrite reduction reaction. The N-doped carbon catalyst (NH<sub>3</sub>) had higher electrocatalytic activities in OER and HER under alkaline conditions and a higher activity for nitrite reduction, as compared with a catalyst prepared by carbonization of the HNO<sub>3</sub>-treated cellulose in N<sub>2</sub>. The electrocatalytic selectivity for nitrite reduction of the N-doped carbon catalyst (NH<sub>3</sub>) was directly related to the graphitic nitrogen functions. Complementary structural analysis by means of <sup>13</sup>C and <sup>1</sup>H ssNMR, scanning electron microscopy (SEM), transmission electron microscopy (TEM), X-ray diffraction (XRD), X-ray photoelectron spectroscopy (XPS), Raman spectroscopy, and low-temperature N<sub>2 </sub>adsorption were preformed and provided support to the findings. The results show that directly-excited <sup>15</sup>N ssNMR at natural <sup>15</sup>N abundance is generally capable to provide information on N-doped carbon materials, and it is expected that the approach can be applied to a wide range of solids with an intermediate amount of N atoms.