The energy spectrum of the cosmic microwave background (CMB) allows us to constrain episodes of energy release in the early Universe. In this paper, we revisit and refine computations of the cosmological thermalization problem. For this purpose a new code, called CosmoTherm, was developed that allows us to solve the coupled photon–electron Boltzmann equation in the expanding, isotropic Universe for a small spectral distortion in the CMB. We explicitly compute the shape of the spectral distortions caused by energy release due to (i) annihilating dark matter; (ii) decaying relict particles; (iii) dissipation of acoustic waves; and (iv) quasi-instantaneous heating. We also demonstrate that (v) the continuous interaction of CMB photons with adiabatically cooling non-relativistic electrons and baryons causes a negativeμ-type CMB spectral distortion of ΔIν/Iν∼ 10−8 in the GHz spectral band. We solve the thermalization problem including improved approximations for the double Compton and Bremsstrahlung emissivities, as well as the latest treatment of the cosmological recombination process. At redshifts z≲ 103, the matter starts to cool significantly below the temperature of the CMB so that at very low frequencies, free–free absorption alters the shape of primordial distortions significantly. In addition, the cooling electrons down-scatter CMB photons, introducing a small late negative y-type distortion at high frequencies. We also discuss our results in the light of the recently proposed CMB experiment PIXIE, for which CosmoTherm should allow detailed forecasting. Our current computations show that for energy injection because of points (ii) and (iv), PIXIE should allow us to improve existing limits, while the CMB distortions caused by the other processes seem to remain unobservable with the currently proposed sensitivities and spectral bands of PIXIE.