Calcium and magnesium are essential for survival but it is unknown how animals detect and consume enough of these minerals to meet their needs. To investigate this, we exploited the PWK/PhJ (PWK) strain of mice, which, in contrast to the C57BL/6J (B6) and other inbred strains, displays strong preferences for calcium solutions. We found that the PWK strain also has strong preferences for MgCl2 and saccharin solutions but not representative salty, sour, bitter, or umami taste compounds. A genome scan of B6 x PWK F2 mice linked a component of the strain difference in calcium and magnesium preference to distal chromosome 4. The taste receptor gene, Tas1r3, was implicated by studies with 129.B6ByJ-Tas1r3 congenic and Tas1r3 knockout mice. Most notably, calcium and magnesium solutions that were avoided by wild-type B6 mice were preferred (relative to water) by B6 mice null for the Tas1r3 gene. Oral calcium elicited less electrophysiological activity in the chorda tympani nerve of Tas1r3 knockout than wild-type mice. Comparison of the sequence of Tas1r3 with calcium and saccharin preferences in inbred mouse strains found 1) an inverse correlation between calcium and saccharin preference scores across primarily domesticus strains, which was associated with an I60T substitution in T1R3, and 2) a V689A substitution in T1R3 that was unique to the PWK strain and thus may be responsible for its strong calcium and magnesium preference. Our results imply that, in addition to its established roles in the detection of sweet and umami compounds, T1R3 functions as a gustatory calcium-magnesium receptor.