Measurements of the differential and double-differential Drell–Yan cross sections in the dielectron and dimuon channels are presented. They are based on proton–proton collision data at √s = 8Tev recorded with the CMS detector at the LHC and corresponding to an integrated luminosity of 19.7 fb-1. The measured inclusive cross section in the Z peak region (60–120GeV), obtained from the combination of the dielectron and dimuon channels, is 1138 ± 8(exp) ± 25 (theo) ± 30 (lumi) pb, where the statistical uncertainty is negligible. The differential cross section dσ/dm in the dilepton mass range 15–2000 GeV is measured and corrected to the full phase space. The double-differential cross section d2σ/dmd|y| is also measured over the mass range 20 to 1500 GeV and absolute dilepton rapidity from 0 to 2.4. In addition, the ratios of the normalized differential cross sections measured at √s = 7 and 8 TeV are presented. These measurements are compared to the predictions of perturbative QCD at next-to-leading and next-to-next-to-leading (NNLO) orders using various sets of parton distribution functions (PDFs). The results agree with the NNLO theoretical predictions computed with fewz 3.1 using the CT10 NNLO and NNPDF2.1 NNLO PDFs. The measured double-differential cross section and ratio of normalized differential cross sections are sufficiently precise to constrain the proton PDFs.