Measurements are presented of the lifetimes of the B0$${\mathrm {B}^0}$$, Bs0$$\mathrm {B}^0_\mathrm {s}$$, Λb0$$\mathrm {\Lambda }_\mathrm {b} ^0$$, and Bc+$$\mathrm {B}_\mathrm {c}^+$$ hadrons using the decay channels B0→J/ψK∗(892)0$${\mathrm {B}^0}\!\rightarrow \! \mathrm {J}/\psi \mathrm {K^{*}(892)}{}^{0}$$, B0→J/ψKS0$${\mathrm {B}^0}\!\rightarrow \! \mathrm {J}/\psi \mathrm {K^0_S}$$, Bs0→J/ψπ+π-$$\mathrm {B}^0_\mathrm {s} \!\rightarrow \! \mathrm {J}/\psi \mathrm {\pi ^+}\mathrm {\pi ^-}$$, Bs0→J/ψϕ(1020)$$\mathrm {B}^0_\mathrm {s} \!\rightarrow \! \mathrm {J}/\psi \mathrm {\phi (1020)}$$, Λb0→J/ψΛ0$$\varLambda _\mathrm {b}^0\!\rightarrow \!\mathrm {J}/\psi \mathrm {\Lambda }^{0}$$, and Bc+→J/ψπ+$$\mathrm {B}_\mathrm {c}^+ \!\rightarrow \!\mathrm {J}/\psi \mathrm {\pi ^+}$$. The data sample, corresponding to an integrated luminosity of 19.7fb-1$$\,\text {fb}^\text {-1}$$, was collected by the CMS detector at the LHC in proton–proton collisions at s=8TeV$$\sqrt{s}=8\,\text {Te}\text {V} $$. The B0$${\mathrm {B}^0}$$ lifetime is measured to be 453.0±1.6(stat)±1.8(syst)μm$$453.0 \pm 1.6\,\text {(stat)} \pm 1.8\,\text {(syst)} \,\upmu \text {m} $$ in J/ψK∗(892)0$$\mathrm {J}/\psi \mathrm {K^{*}(892)}{}^{0}$$and 457.8±2.7(stat)±2.8(syst)μm$$457.8 \pm 2.7\,\text {(stat)} \pm 2.8\,\text {(syst)} \,\upmu \text {m} $$ in J/ψKS0$$ \mathrm {J}/\psi \mathrm {K^0_S}$$, which results in a combined measurement of cτB0=454.1±1.4(stat)±1.7(syst)μm$$c\tau _{{\mathrm {B}^0}} = 454.1 \pm 1.4\,\text {(stat)} \pm 1.7\,\text {(syst)} \,\upmu \text {m} $$. The effective lifetime of the Bs0$$\mathrm {B}^0_\mathrm {s}$$ meson is measured in two decay modes, with contributions from different amounts of the heavy and light eigenstates. This results in two different measured lifetimes: cτBs0→J/ψπ+π-=502.7±10.2(stat)±3.4(syst)μm$$c\tau _{\mathrm {B}^0_\mathrm {s} \rightarrow \mathrm {J}/\psi \mathrm {\pi ^+}\mathrm {\pi ^-}} = 502.7 \pm 10.2\,\text {(stat)} \pm 3.4\,\text {(syst)} \,\upmu \text {m} $$ and cτBs0→J/ψϕ(1020)=443.9±2.0(stat)±1.5(syst)μm$$c\tau _{\mathrm {B}^0_\mathrm {s} \rightarrow \mathrm {J}/\psi \mathrm {\phi (1020)}} = 443.9 \pm 2.0\,\text {(stat)} \pm 1.5\,\text {(syst)} \,\upmu \text {m} $$. The Λb0$$\mathrm {\Lambda }_\mathrm {b} ^0$$ lifetime is found to be 442.9±8.2(stat)±2.8(syst)μm$$442.9 \pm 8.2\,\text {(stat)} \pm 2.8\,\text {(syst)} \,\upmu \text {m} $$. The precision from each of these channels is as good as or better than previous measurements. The Bc+$$\mathrm {B}_\mathrm {c}^+$$ lifetime, measured with respect to the B+$${\mathrm {B}^{+}}$$ to reduce the systematic uncertainty, is 162.3±7.8(stat)±4.2(syst)±0.1(τB+)μm$$162.3 \pm 7.8\,\text {(stat)} \pm 4.2\,\text {(syst)} \pm 0.1\,(\tau _{{\mathrm {B}^{+}}})\,\upmu \text {m} $$. All results are in agreement with current world-average values.