The defect levels of the nitrogen dangling bond at the Si/SiO2 interface are determined through a density-functional approach. The composition grading at the interface is modeled through crystalline and amorphous models of stoichiometric SiO2, nitrided SiO2, and substoichiometric silicon oxides. The relevant charge transition levels are first determined with respect to the band edges of the parent oxides within a semilocal density-functional scheme. Through the use of band edge shifts and band offsets previously obtained with hybrid functionals, the calculated defect levels are then positioned with respect to a band diagram of the Si/SiO2 interface which shows good agreement with the experimental one. We find that the 0/- charge transition level locates within the Si band gap. The level locates close to the Si valence band for nitrogen atoms in the stoichiometric oxide, but is found to rise across the silicon band gap as the environment of the nitrogen atoms becomes more silicon rich. The latter raise is accompanied by a stabilization of the incorporated nitrogen.