The igneous portion of Earth’s continental crust is a major long-term sink of nitrogen on Earth, but the origin of the nitrogen in this reservoir remains ambiguous. Possible sources include magmatic differentiation of mantle-derived melts (i.e. magmatic nitrogen) and/or the burial of biomass (i.e. fixed atmospheric nitrogen). Identifying the primary source of crustal nitrogen is thus important for accurately reconstructing the evolution of atmospheric pressure, and therefore the habitability of Earth, over geologic timescales. Here we present new data from Hekla volcano, Iceland, revealing that magmatic differentiation of a mantle-derived melt can yield up to 23 μg/g of nitrogen in evolved silicate rocks. By comparison with compiled literature data, we find that this level of enrichment can satisfy 35-52% of Earth’s granitic crust-hosted nitrogen, a significant portion of upper crustal lithologies. These results show that nitrogen is not always degassed from magmatic systems; instead, the formation of Earth’s continental crust acts as a trap of nitrogen between the mantle and the atmosphere, which is important to consider in models of atmospheric formation and evolution over geological timescales.