We study the evolution of phase-space density during the hierarchical structure formation of Λ cold dark matter (CDM) haloes. We compute both a spherically averaged surrogate for phase-space density (Q=ρ/σ3) and the coarse-grained distribution function f(x, v) for dark matter (DM) particles that lie within ∼2 virial radii of four Milky Way sized dark matter haloes. The estimated f(x, v) spans over four decades at any radius. DM particles that end up within 2 virial radii of a Milky Way sized DM halo at z= 0 have an approximately Gaussian distribution in log (f) at early redshifts, but the distribution becomes increasingly skewed at lower redshifts. The value fpeak corresponding to the peak of the Gaussian decreases as the evolution progresses and is well described by fpeak(z) ∝ (1 +z)4.5 for z > 1. The highest values of f (responsible for the skewness of the profile) are found at the centres of dark matter haloes and subhaloes, where f can be an order of magnitude higher than in the centre of the main halo. We confirm that Q(r) can be described by a power law with a slope of −1.8 ± 0.1 over 2.5 orders of magnitude in radius and over a wide range of redshifts. This Q(r) profile likely reflects the distribution of entropy (K≡σ2/ρ2/3DM∝r1.2), which dark matter acquires as it is accreted on to a growing halo. The estimated f(x, v), on the other hand, exhibits a more complicated behaviour. Although the median coarse-grained phase-space density profile F(r) can be approximated by a power law, ∝r−1.6±0.15, in the inner regions of haloes (<0.6 rvir), at larger radii the profile flattens significantly. This is because phase-space density averaged on small scales is sensitive to the high-f material associated with surviving subhaloes, as well as relatively unmixed material (probably in streams) resulting from disrupted subhaloes, which contribute a sizable fraction of matter at large radii.