Abstract. Magnesium is an element critically involved in the carbon cycle, because weathering of Ca-Mg silicates removes atmospheric CO 2 into rivers, and formation of Ca-Mg carbonates in the oceans removes carbon from the oceanatmosphere system. Hence the Mg cycle holds the potential to provide valuable insights into Cenozoic climate-system history, and the shift during this time from a greenhouse to icehouse state. We present Mg isotope ratios for the past 40 Myr using planktic foraminifers as an archive. Modern foraminifera, which discriminate against elemental and isotopically heavy Mg during calcification, show no correlation between the Mg isotope composition (δ 26 Mg, relative to DSM-3) and temperature, Mg / Ca or other parameters such as carbonate saturation ( CO 3 ). However, inter-species isotopic differences imply that only well-calibrated single species should be used for reconstruction of past seawater. Seawater δ 26 Mg inferred from the foraminiferal record decreased from ∼ 0 ‰ at 15 Ma, to −0.83 ‰ at the present day, which coincides with increases in seawater lithium and oxygen isotope ratios. It strongly suggests that neither Mg concentrations nor isotope ratios are at steady state in modern oceans, given its ∼ 10 Myr residence time. From these data, we have developed a dynamic box model to understand and constrain changes in Mg sources to the oceans (rivers) and Mg sinks (dolomitisation and hydrothermal alteration). Our estimates of seawater Mg concentrations through time are similar to those independently determined by pore waters and fluid inclusions. Modelling suggests that dolomite formation and the riverine Mg flux are the primary controls on the δ 26 Mg of seawater, while hydrothermal Mg removal and the δ 26 Mg of rivers are more minor controls. Using Mg riverine flux and isotope ratios inferred from the 87 Sr / 86 Sr record, the modelled Mg removal by dolomite formation shows minima in the Oligocene and at the present day (with decreasing trends from 15 Ma), both coinciding with rapid decreases in global temperatures.