Nitrogen (N) is a major ingredient of the atmosphere, but a trace component in the silicate Earth. However, the combined volatile inventory of these reservoirs shows a well-documented N deficit compared to CI chondrites, suggesting mechanisms such as core formation, early atmospheric loss, or a combination of both to account for this depletion. The initial inventory of N during Earth's early differentiation requires knowledge of N speciation and its partitioning behaviour between metal and silicate melts in the magma ocean, both of which vary with pressure, temperature, and redox conditions. In this presentation, I will discuss our recent progress in understanding (i) N speciation in silicate melts at varying P-T-redox conditions based on ab initio molecular dynamics simulations, and (ii) high pressure metal–silicate partitioning of N determined through laser-heated diamond anvil cell experiments, and the implications of these findings for planetary accretion and differentiation processes.