The chemical composition and microstructure of the calcite cuticles of eleven species of phacopine trilobites have been investigated by electron beam imaging, diffraction, and microanalysis, and results reveal that the lenses of their schizochroal eyes differed significantly in chemical composition from the rest of the cuticle in vivo. Apart from the eye lenses, most cuticles are inferred to have escaped extensive recrystallisation because their constituent crystals are sub-micrometre in size and have a preferred orientation that is consistent between species. Their current compositions of ~1.4 to 2.4mol% MgCO3 are likely to be close to original values, although as they commonly luminesce and contain detectable manganese and iron, some diagenetic alteration has taken place. The associated lenses have a microstructure that is suitable for focusing light, yet are optically turbid owing to the presence within calcite of micropores and crystals of microdolomite, apatite, celestite and pyrite. The microdolomite indicates that lenses recrystallised from an original high-Mg calcite composition and this is supported by the presence of nanometre-scale modulated microstructures in both the calcite and dolomite. These lenses currently contain ~1 to 6mol% MgCO3, and by comparison with the proportion of magnesium lost from echinoderm stereom in the same thin sections, may have contained ~7.5mol% MgCO3in vivo. In some samples, more extensive diagenetic alteration is evidenced by recrystallisation of the cuticle including lenses to coarse equant calcite or enrichment of the cuticle, but not necessarily the lenses, in magnesium accompanying replacement by a Mg–Fe phyllosilicate. The phacopine trilobites had to modify partition coefficients for magnesium considerably in order to grow lenses with contrasting compositions to the rest of their cuticles, and such a strong vital effect on biomineralisation suggests that incorporation of magnesium was essential for functioning of their calcite optical systems.