Free cytosolic [Mg2+] can be assessed in vivo by 31P MRS from the chemical shift of beta-ATP which in turn depends on the fraction of total ATP complexed to Mg2+ ions. The reliability of these in vivo measurements depends on the availability of an appropriate in vitro calibration to determine the limits of chemical shifts of unbound ATP and Mg-ATP complexes, using solutions that mimic the in vivo cytosolic conditions as far as possible. We used an algorithm and software to allow a quantitative definition of the Mg(2+)-binding molecules to build a semi-empirical equation that correlates the chemical shift of the beta-ATP signal to the [Mg2+] taking into account the amount of Mg2+ bound to all other constituents in solution. Our experiments resulted in a simple and reliable equation directly usable to assess in vivo the free cytosolic magnesium concentration of human brain by 31P MRS. Our method is also flexible enough to make it suitable for in vivo measurements of [Mg2+] in other organs and tissues.