Constraints on the lifetime and width of the Higgs boson are obtained from H -> ZZ -> 4l events using data recorded by the CMS experiment during the LHC run 1 with an integrated luminosity of 5.1 and 19.7 fb(-1) at a center-of-mass energy of 7 and 8 TeV, respectively. The measurement of the Higgs boson lifetime is derived from its flight distance in the CMS detector with an upper bound of tau(H) < 1.9 x 10(-13) s at the 95% confidence level (C.L.), corresponding to a lower bound on the width of Gamma(H) > 3.5 x 10(-9) MeV. The measurement of the width is obtained from an off-shell production technique, generalized to include anomalous couplings of the Higgs boson to two electroweak bosons. From this measurement, a joint constraint is set on the Higgs boson width and a parameter f(Lambda Q) that expresses an anomalous coupling contribution as an on-shell cross-section fraction. The limit on the Higgs boson width is Gamma(H) < 46 MeV with f(Lambda Q) unconstrained and Gamma(H) < 26 MeV for f(Lambda Q) = 0 at the 95% C.L. The constraint f(Lambda Q) < 3.8 x 10(-3) at the 95% C.L. is obtained for the expected standard model Higgs boson width.