Context. Line shapes of the magnesium resonance lines in white dwarf spectra are determined by the properties of magnesium atoms and the structure of the white dwarf atmosphere. Through their blanketing effect, these lines have a dominant influence on the model structure and thus on the determination from the spectra of other physical parameters that describe the stellar atmosphere and elemental abundances. Aims. In continuation of previous work on Mg+He lines in the UV, we present theoretical profiles of the resonance line of neutral Mg perturbed by He at the extreme density conditions found in the cool largely transparent atmosphere of DZ white dwarfs. Methods. We accurately determined the broadening of Mg by He in a unified theory of c...