Grasslands are subject to considerable alteration due to human activities globally, including widespread changes in populations and composition of large mammalian herbivores and elevated supply of nutrients. Grassland soils remain important reservoirs of carbon (C) and nitrogen (N). Herbivores may affect both C and N pools and these changes likely interact with increases in soil nutrient availability. Given the scale of grassland soil fluxes, such changes can have striking consequences for atmospheric C concentrations and the climate. Here, we use the Nutrient Network experiment to examine the responses of soil C and N pools to mammalian herbivore exclusion across 22 grasslands, under ambient and elevated nutrient availabilities (fertilized with NPK + micronutrients). We show that the impact of herbivore exclusion on soil C and N pools depends on fertilization. Under ambient nutrient conditions, we observed no effect of herbivore exclusion, but under elevated nutrient supply, pools are smaller upon herbivore exclusion. The highest mean soil C and N pools were found in grazed and fertilized plots. The decrease in soil C and N upon herbivore exclusion in combination with fertilization correlated with a decrease in aboveground plant biomass and microbial activity, indicating a reduced storage of organic matter and microbial residues as soil C and N. The response of soil C and N pools to herbivore exclusion was contingent on temperature – herbivores likely cause losses of C and N in colder sites and increases in warmer sites. Additionally, grasslands that contain mammalian herbivores have the potential to sequester more N under increased temperature variability and nutrient enrichment than ungrazed grasslands. Our study highlights the importance of conserving mammalian herbivore populations in grasslands worldwide. We need to incorporate local-scale herbivory, and its interaction with nutrient enrichment and climate, within global-scale models to better predict land–atmosphere interactions under future climate change. © 2020 The Authors. Global Change Biology published by John Wiley & Sons Ltd