We use a high-resolution ΛCDM numerical simulation to calculate the mass function of dark matter haloes down to the scale of dwarf galaxies, back to a redshift of 15, in a 50 h−1 Mpc volume containing 80 million particles. Our low-redshift results allow us to probe low-σ density fluctuations significantly beyond the range of previous cosmological simulations. The Sheth & Tormen mass function provides an excellent match to all of our data except for redshifts of 10 and higher, where it overpredicts halo numbers increasingly with redshift, reaching roughly 50 per cent for the 1010-1011 M⊙ haloes sampled at redshift 15. Our results confirm previous findings that the simulated halo mass function can be described solely by the variance of the mass distribution, and thus has no explicit redshift dependence. We provide an empirical fit to our data that corrects for the overprediction of extremely rare objects by the Sheth & Tormen mass function. This overprediction has implications for studies that use the number densities of similarly rare objects as cosmological probes. For example, the number density of high-redshift (z≃ 6) QSOs, which are thought to be hosted by haloes at 5σ peaks in the fluctuation field, are likely to be overpredicted by at least a factor of 50 per cent. We test the sensitivity of our results to force accuracy, starting redshift and halo-finding algorith