  We compute the relation between the pole mass and the kinetic mass of a heavy
quark to three loops. Using the known relation between the pole and the
$\overline{\rm MS}$ mass we obtain precise conversion relations between the
$\overline{\rm MS}$ and kinetic masses. The kinetic mass is defined via the
moments of the spectral function for the scattering involving a heavy quark
close to threshold. This requires the computation of the imaginary part of a
forward scattering amplitude up to three-loop order. We discuss in detail the
expansion procedure and the reduction to master integrals. For the latter
analytic results are provided. We apply our result both to charm and bottom
quark masses. In the latter case we compute and include finite charm quark mass
effects. Furthermore, we determine the large-$\beta_0$ result for the
conversion formula at four-loop order. For the bottom quark we estimate the
uncertainty in the conversion between the $\overline{\rm MS}$ and kinetic
masses to about 15 MeV which is an improvement by a factor two to three as
compared to the two-loop formula. The improved precision is crucial for the
extraction of the Cabibbo-Kobayashi-Maskawa matrix element $|V_{cb}|$ at Belle
II.
