The primary mineralogy of oolites and early marine carbonate cements led Sandberg [Nature 305 (1983), 19–22] to divide the Phanerozoic Eon into three intervals of `aragonite seas' and two intervals of `calcite seas'. Hardie [Geology 24 (1996), 279–283] has shown that these oscillations, together with synchronous oscillations in the mineralogy of marine potash evaporites, can be explained by secular shifts in the Mg/Ca ratio of seawater driven by changes in spreading rates along mid-ocean ridges. The Hardie model also predicts that high-Mg calcite should precipitate along with aragonite, as it does in today's aragonite sea. We have uncovered oscillations in the carbonate mineralogy of hypercalcifying organisms (ones that have produced massive skeletons, large reefs, or voluminous bodies of sediment) that correspond to Sandberg's aragonite seas and calcite seas and that are predicted by the Hardie model. Particular groups of corals, sponges, and algae appear to have been dominant reef builders only when favored by an appropriate Mg/Ca ratio in seawater. In early and middle Paleozoic calcite seas (Calcite I), reefs were dominated by calcitic tabulate, heliolitid, and rugose corals and calcitic stromatoporoids. In contrast, during the period of late Paleozoic–early Mesozoic aragonite seas (Aragonite II), aragonitic groups of sponges, scleractinian corals, and phylloid algae, as well as high-Mg calcitic red algae, were principal reef builders. During Late Cretaceous time, at the acme of Calcite II, massive rudists displaced aragonitic hermatypic corals. In today's aragonite sea (Aragonite III) scleractinian corals are again dominant reef builders, along with high-Mg calcitic coralline algae. Major sediment-producing algae exhibit temporal patterns similar to those of reef builders. Calcitic receptaculitids flourished during Calcite I, whereas aragonitic dasycladaceans did not become dominant rock formers until Aragonite II. During Calcite II, calcitic nannoplankton formed massive coccolith chalks in warm shallow seas of the Late Cretaceous, after the Mg/Ca ratio of seawater had reached a very low value and calcium concentration, a very high value. As the Mg/Ca ratio of seawater rose and calcium concentration fell during the Cenozoic Era, individual coccoliths, on average, became less massive and encrusted cells less thickly. By Pliocene time, during Aragonite III, the prominent genus Discoaster secreted only narrow-rayed coccoliths that covered less than 25% of the cell surface. Also during Aragonite III, the aragonitic green alga Halimeda emerged as the dominant skeletal sediment producer in reef tracts. The influence of seawater chemistry on skeletal secretion appears to have been especially strong for morphologically simple taxa that exert relatively weak control over their own calcification. Such groups include algae, sponges, corals, and bryozoans. Morphological simplicity also permits these groups to adopt vegetative or colonial modes of growth that confer success in competition for space on reefs. This linkage, in addition to the basic chemical demands of hypercalcification, has given the Mg/Ca ratio of seawater strong control over the success of individual reef-building taxa. More generally, this ratio appears to have strongly influenced evolutionary changes in the skeletal mineralogy of sponges and cheilostome bryozoans throughout their history. We conclude that throughout Phanerozoic time a chain of causation has extended from mid-ocean ridge processes, via seawater chemistry, to the mineralogical and biological composition of reef communities and bioclastic carbonate deposits.