Magnetohydrodynamics couples the Navier–Stokes and Maxwell’s equations to describe the flow of electrically conducting fluids in magnetic fields. Maxwell’s equations require the divergence of the magnetic field to vanish, but this condition is typically not preserved exactly by numerical algorithms. Solutions can develop artifacts because structural properties of the magnetohydrodynamic equations then fail to hold. Magnetohydrodynamics with hyperbolic divergence cleaning permits a nonzero divergence that evolves under a telegraph equation, designed to both damp the divergence, and propagate it away from any sources, such as poorly resolved regions with large spatial gradients, without significantly increasing the computational cost. We show that existing lattice Boltzmann algorithms for magnetohydrodynamics already incorporate hyperbolic divergence cleaning, though they typically use parameter values for which it reduces to parabolic divergence cleaning under a slowly-varying approximation. We recover hyperbolic divergence cleaning by adjusting the relaxation rate for the trace of the tensor that represents the electric field, and absorb the contribution from the symmetric-traceless part of this tensor using a change of variables. Numerical experiments confirm that the qualitative behaviour changes from parabolic to hyperbolic when the relaxation time for the trace of the electric field tensor is increased.