Excessive agricultural nitrogen use causes environmental problems globally1, to an extent that it has been suggested that a safe planetary boundary has been exceeded2. Earlier estimates for the planetary nitrogen boundary3,4, however, did not account for the spatial variability in both ecosystems’ sensitivity to nitrogen pollution and agricultural nitrogen losses. Here we use a spatially explicit model to establish regional boundaries for agricultural nitrogen surplus from thresholds for eutrophication of terrestrial and aquatic ecosystems and nitrate in groundwater. We estimate regional boundaries for agricultural nitrogen pollution and find both overuse and room for intensification of agricultural nitrogen. The aggregated global surplus boundary with respect to all thresholds is 43 megatonnes of nitrogen per year, which is 64 per cent lower than the current (2010) nitrogen surplus (119 megatonnes of nitrogen per year). Allowing the nitrogen surplus to increase to close yield gaps in regions where environmental thresholds are not exceeded lifts the planetary nitrogen boundary to 57 megatonnes of nitrogen per year. Feeding the world without trespassing regional and planetary nitrogen boundaries requires large increases in nitrogen use efficiencies accompanied by mitigation of non-agricultural nitrogen sources such as sewage water. This asks for coordinated action that recognizes the heterogeneity of agricultural systems, non-agricultural nitrogen losses and environmental vulnerabilities.