Aims. We have completed an accurate investigation of the Ca isotopic composition and stratification in the atmospheres of 23 magnetic chemically peculiar (Ap) stars of different temperature and magnetic field strength. Methods. With the UVES spectrograph at the 8 m ESO VLT, we have obtained high-resolution spectra of Ap stars in the wavelength range 3000-10 000 Å. Using a detailed spectrum synthesis calculations, we have reproduced a variety of Ca lines in the optical and ultraviolet spectral regions, inferring the overall vertical distribution of Ca abundance, and have deduced the relative isotopic composition and its dependence on height using the profile of the IR-triplet Ca ii line at λ8498 Å.Results. In 22 out of 23 studied stars, we found that Ca is strongly stratified, being usually overabundant by 1.0-1.5 dex below log τ 5000 ≈ −1, and strongly depleted above log τ 5000 = −1.5. The IR-triplet Ca ii line at λ8498 Å reveals a significant contribution of the heavy isotopes 46 Ca and 48 Ca, which represent less than 1 % of the terrestrial Ca isotopic mixture. We confirm our previous finding that the presence of heavy Ca isotopes is generally anticorrelated with the magnetic field strength. Moreover, we discover that in Ap stars with relatively small surface magnetic fields (≤4-5 kG), the light isotope 40 Ca is concentrated close to the photosphere, while the heavy isotopes are dominant in the outer atmospheric layers. This vertical isotopic separation, observed for the first time for any metal in a stellar atmosphere, disappears in stars with magnetic field strength above 6-7 kG. Conclusions. We suggest that the overall Ca stratification and depth-dependent isotopic anomaly observed in Ap stars may be attributed to a combined action of the radiatively-driven diffusion and light-induced drift.