The electrostatic contribution to the Mössbauer isomer shift of mercury for the series HgF n (n = 1, 2, 4) with respect to the neutral atom has been investigated in the framework of four-and two-component relativistic theory. Replacing the integration of the electron density over the nuclear volume by the contact density (that is, the electron density at the nucleus) leads to a 10% overestimation of the isomer shift. The systematic nature of this error suggests that it can be incorporated into a correction factor, thus justifying the use of the contact density for the calculation of the Mössbauer isomer shift. The performance of a large selection of density functionals for the calculation of contact densities has been assessed by comparing with finite-field four-component relativistic coupled-cluster with single and double and perturbative triple excitations [CCSD(T)] calculations. For the absolute contact density of the mercury atom, the Density Functional Theory (DFT) calculations are in error by about 0.5%, a result that must be judged against the observation that the change in contact density along the series HgF n (n = 1, 2, 4), relevant for the isomer shift, is on the order of 50 ppm with respect to absolute densities. Contrary to previous studies of the 57 Fe isomer shift (F Neese, Inorg Chim Acta 332:181, 2002), for mercury, DFT is not able to reproduce the trends in the isomer shift provided by reference data, in our case CCSD(T) calculations, notably the non-monotonous decrease in the contact density along the series HgF n (n = 1, 2, 4). Projection analysis shows the expected reduction of the 6s 1/2 population at the mercury center with an increasing number of ligands, but also brings into light an opposing effect, namely the increasing polarization of the 6s 1/2 orbital due to increasing effective charge of the mercury atom, which explains the nonmonotonous behavior of the contact density along the series. The same analysis shows increasing covalent contributions to bonding along the series with the effective charge of the mercury atom reaching a maximum of around ?2 for HgF 4 at the DFT level, far from the formal charge ?4 suggested by the oxidation state of this recently observed species. Whereas the geometries for the linear HgF 2 and square-planar HgF 4 molecules were taken from previous computational studies, we optimized the equilibrium distance of HgF at the four-component Fock-space CCSD/aug-cc-pVQZ level, giving spectroscopic constants r e = 2.007 Å and x e = 513.5 cm -1 .Dedicated to Professor Pekka Pyykkö on the occasion of his 70th birthday and published as part of the Pyykkö Festschrift Issue.Electronic supplementary material The online version of this article