Deep inelastic scattering and its diffractive component, e p → e ′ γ ∗ p → e ′ X N , have been studied at HERA with the ZEUS detector using an integrated luminosity of 52.4 pb −1. The M X method has been used to extract the diffractive contribution. A wide range in the centre-of-mass energy W (37–245 GeV), photon virtuality Q 2 (20–450 GeV 2) and mass M X (0.28–35 GeV) is covered. The diffractive cross section for 2 < M X < 15 GeV rises strongly with W, the rise becoming steeper as Q 2 increases. The data are also presented in terms of the diffractive structure function, F 2 D ( 3 ) , of the proton. For fixed Q 2 and fixed M X , x P F 2 D ( 3 ) shows a strong rise as x P → 0 , where x P is the fraction of the proton momentum carried by the pomeron. For Bjorken- x < 1 × 10 −3 , x P F 2 D ( 3 ) shows positive log Q 2 scaling violations, while for x ⩾ 5 × 10 −3 negative scaling violations are observed. The diffractive structure function is compatible with being leading twist. The data show that Regge factorisation is broken.