The diffusion of nitrogen through gamma(Ni)/gamma'(L1(2)-Ni3Al) interface in Ni-based superalloys was investigated based on first-principles calculations and the different nitriding behaviors of gamma matrix and gamma' precipitate were determined. At the interface, nitrogen atoms prefer to occupy the 6-Ni octahedral interstitial site with a large physical volume rather than the octahedral site constituted by Ni and Al with good chemical affinity. This indicates that gamma matrix can provide more trapping sites for nitrogen atom than gamma' precipitate. Moreover, the migration energy barrier of N crossing the (002)gamma/gamma' coherent plane is higher than that in gamma phase. Nitrogen atoms can move into gamma' phase unless the diffusion front has higher nitrogen concentration and O-4* (5Ni-Al octahedral site) is occupied. Inside the gamma' matrix, nitrogen atoms are also easily trapped by the 6-Ni octahedral interstitial site, but their escape rates are much lower. It is the potential barrier role of the (002)gamma/gamma' coherent plane and the low diffusion ability of N in gamma' that are responsible for the unfavorable nitriding behavior of gamma' phase in Ni-based superalloys. (C) 2022 Elsevier B.V. All rights reserved.