Grassland fencing is acknowledged as a crucial initiative to enhance biodiversity and to increase soil organic carbon (SOC) content in ecologically fragile regions or barren systems. Theoretical perspectives propose that fencing induced an increase in root biomass, and its penetration into the soil profile introduced organic matter that facilitated SOC formation through microbial necromass and root residues. It is hypothesized that long-term grassland fencing increases root biomass, thereby enhancing SOC formation within the soil profile through microbial residues in badland ecosystems. To test this hypothesis, we selected grasslands subjected to varying durations of fencing post-grazing (i.e., 10, 15, 20, 30, and 40 y). Our investigation aimed to clarify microbial necromass dynamics in 0–100 cm soil profiles after fencing and to identify the influencing factors. Long-term grassland fencing (i.e., >30 y) increased root biomass by 160 %, SOC by 69 %, and necromass by 41 % compared to grazed grassland within the 0–40 cm horizon; in contrast, increased root biomass by 870 %, SOC by 111 %, and necromass by 46 % in the 40–100 cm horizon. Necromass in deep soil (40–100 cm) accounted for about 50 % of total residues in the 0–100 cm profile. Increased root and living microbial biomass stimulated the necromass accumulation, with a more pronounced increase in fungal residues compared with bacterial residues. Nonetheless, microbial nutrient limitation increases C or N-acquisition enzyme coefficients, which subsequently reduced fungal and bacterial residues and stimulated their recycling. Despite substantial increases in root biomass within the soil profile after fencing, limitation of microbial N and depth reduced the effectiveness of enhancing SOC and necromass. In conclusion, although microbial residues were the important source of SOC in grasslands of the Loess Plateau, microbial N limitation impeded necromass accumulation, and the interplay of root biomass, soil depth, and nutrient limitation regulated the dynamics of necromass following grassland fencing.