A measurement of the inclusive ZZ production cross section and constraints on anomalous triple gauge couplings in proton–proton collisions at s=8 TeV are presented. The analysis is based on a data sample, corresponding to an integrated luminosity of 19.6 fb−1 , collected with the CMS experiment at the LHC. The measurements are performed in the leptonic decay modes ZZ→ℓℓℓ′ℓ′ , where ℓ=e,μ and ℓ′=e,μ,τ . The measured total cross section σ(pp→ZZ)=7.7±0.5 (stat)−0.4+0.5 (syst)±0.4(theo)±0.2 (lumi) pb , for both Z bosons produced in the mass range 60<mZ<120 GeV , is consistent with standard model predictions. Differential cross sections are measured and well described by the theoretical predictions. The invariant mass distribution of the four-lepton system is used to set limits on anomalous ZZZ and ZZγ couplings at the 95% confidence level: −0.004<f4Z<0.004 , −0.004<f5Z<0.004 , −0.005<f4γ<0.005 , and −0.005<f5γ<0.005 .