Magnesium oxide and sulfide spinels have recently attracted interest as cathode and electrolyte materials for energy-dense Mg batteries, but their observed electrochemical performance depends strongly on synthesis conditions. Using first-principles calculations and percolation theory, we explore the extent to which spinel inversion influences Mg 2+ ionic mobility in MgMn 2 O 4 as a prototypical cathode, and MgIn 2 S 4 as a potential solid electrolyte. We find that spinel inversion and the resulting changes of the local cation ordering give rise to both increased and decreased Mg 2+ migration barriers, along specific migration pathways, in the oxide as well as the sulfide. To quantify the impact of spinel inversion on macroscopic Mg 2+ transport, we determine the percolation thresholds in both MgMn 2 O 4 and MgIn 2 S 4 . Furthermore, we analyze the impact of inversion on the electrochemical properties of the MgMn 2 O 4 cathode via changes in the phase behavior, average Mg insertion voltages and extractable capacities, at varying degrees of inversion. Our results confirm that inversion is a major performance limiting factor of Mg spinels and that synthesis techniques or compositions that stabilize the well-ordered spinel structure are crucial for the success of Mg spinels in multivalent batteries.