This Letter reports measurements of differential cross sections for the production of two Z bosons in association with jets in proton–proton collisions at s=8 and 13 TeV. The analysis is based on data samples collected at the LHC with the CMS detector, corresponding to integrated luminosities of 19.7 and 35.9fb −1 at 8 and 13 TeV, respectively. The measurements are performed in the leptonic decay modes ZZ→ℓ + ℓ − ℓ ′+ ℓ ′− , where ℓ,ℓ ′ =e,μ. The differential cross sections as a function of the jet multiplicity, the transverse momentum p T , and pseudorapidity of the p T -leading and subleading jets are presented. In addition, the differential cross sections as a function of variables sensitive to the vector boson scattering, such as the invariant mass of the two p T -leading jets and their pseudorapidity separation, are reported. The results are compared to theoretical predictions and found in good agreement within the theoretical and experimental uncertainties.