A technique for computing electroweak next-to-next-to-leading order
(NNLO) corrections with arbitrary masses is described. It is based on using a dispersion relation and Feynman parameters for one of the two subloops and leads to low-dimensional numerical integrals for any $2\to2$ scattering process. UV divergencies can be treated with suitable subtraction terms. As a concrete phenomenological application, the calculation of electroweak NNLO corrections
with closed fermion loops to the process $e^+e^- \to ZH$ is discussed.