The well-established theories of the strong interaction and the electroweak theory determine the evolution of the early universe. The Hubble rate and the relationship between the age of the universe and its temperature are determined by the equation of state. Since QCD is highly non-perturbative, the calculation of the EoS is a particularly difficult task. The only systematic way to carry out this calculation is based on lattice QCD. A complete results of such a calculation is presented. QCD, unlike the rest of the Standard Model, is surprisingly symmetric under time reversal, leading to a serious fine tuning problem. The most attractive solution for this is a new particle, the axion –a promising dark matter candidate. Assuming that axions are the dominant component of dark matter we determine the axion mass. The key quantities of the calculation are the previously mentioned EoS and the temperature dependence of the topological susceptibility.