The resurgence of electromobility drives the need for high energy density cathode materials. LiNiO2 (LNO) meets this demand, based on its high specific capacity in a narrow voltage range and without relying on scare elements. Yet, it has been plagued by various issues, such as poor cycling performance and thermal instability. Adding dopants, such as widely available Mg2+, is a common strategy to balance cycling performance and energy density. Most prior studies focused on large Mg content ranges and were based on laboratory X-ray diffraction. Hence, the influence of Mg2+ addition on the crystal structure remains ambiguous, especially when small amounts are used (≤ 5 mol%; particularly interesting for industrial applications). Here, we present a systematic study of LiNi1−y Mg y O2 (0 ≤ y ≤ 0.05) investigated by high-resolution synchrotron-based X-ray diffraction combined with elemental analysis, electron microscopy and electrochemical testing. The synthetic route relies on the addition of 10 nm Mg(OH)2 nanoparticles prior to the final calcination, as well as on co-precipitation. It is found that Mg2+ mostly occupies the Ni site until saturating at ∼1.7%, then the Li site becomes preferred. This trend in the site occupancies influences the lattice parameters, oxygen coordinate within the unit cell and Ni–O bond distances. Doping also modifies the electrochemical behavior as a cathode material, stabilizing the capacity retention during cycling but sacrificing specific discharge capacity. Laboratory-based operando X-ray diffraction reveals that the increase in capacity retention is due to the suppression of the H2-H3 phase transition and interlayer distance collapse already in 3% Mg-doped LNO. The combination of structural and electrochemical characterization of doped LNO provides useful insights into the structural chemistry of the Mg2+ dopant and can serve as a starting point to understand Mg as a component in multiple dopant strategies for cathode material design and application.