The locations of the peaks of the cosmic microwave background (CMB) spectrum are sensitive indicators of cosmological parameters, yet there is no known analytic formula which accurately describes their dependence on them. We parametrize the location of the peaks as l(m), = l(A)(m - phi(m)), where l(A) is the analytically calculable acoustic scale and m labels the peak number. Fitting formulae for the phase shifts phi(m) for the first three peaks and the first trough are given. It is shown that in a wide range of parameter space, the acoustic scale l(A) can be retrieved from actual CMB measurements of the first three peaks within 1 per cent accuracy. This can be used to speed up likelihood analysis. We describe how the peak shifts can be used to distinguish between different models of dark energy.