We observed and analysed the extreme-ultraviolet spectra of highly charged ions of Kr XXI–Kr XXXIV produced in an electron beam ion trap (EBIT). The beam energies varied between 1.1 and 30 keV, and the wavelengths were observed between 3 and 17.3 nm with uncertainties of ∼0.003 nm. Six new lines were identified, and wavelength uncertainties have been improved for twelve additional transitions. It was found that a line intensity ratio for allowed transitions 3s23p–3s23d in Al-like Kr XXIV strongly deviated from predictions based on statistical weighting of the excited levels. Collisional-radiative modelling showed that this effect, which is due to the magnetic-dipole transition within the ground configuration 3s23p, offers sensitive diagnostics of electron density in the regime of interest to fusion tokamaks, EBITs, and other low-density plasmas.