We describe the legacy Planck cosmic microwave background (CMB) likelihoods derived from the 2018 data release. The overall approach is similar in spirit to the one retained for the 2013 and 2015 data release, with a hybrid method using different approximations at low (ℓ < 30) and high (ℓ ≥ 30) multipoles, implementing several methodological and data-analysis refinements compared to previous releases. With more realistic simulations, and better correction and modelling of systematic effects, we can now make full use of the CMB polarization observed in the High Frequency Instrument (HFI) channels. The low-multipole EE cross-spectra from the 100 GHz and 143 GHz data give a constraint on the λCDM reionization optical-depth parameter τ to better than 15% (in combination with the TT low-ℓ data and the high-ℓ temperature and polarization data), tightening constraints on all parameters with posterior distributions correlated with τ. We also update the weaker constraint on τ from the joint TEB likelihood using the Low Frequency Instrument (LFI) channels, which was used in 2015 as part of our baseline analysis. At higher multipoles, the CMB temperature spectrum and likelihood are very similar to previous releases. A better model of the temperature-to-polarization leakage and corrections for the effective calibrations of the polarization channels (i.e., the polarization efficiencies) allow us to make full use of polarization spectra, improving the λCDM constraints on the parameters θMC, ωc, ωb, and H0 by more than 30%, and ns by more than 20% compared to TT-only constraints. Extensive tests on the robustness of the modelling of the polarization data demonstrate good consistency, with some residual modelling uncertainties. At high multipoles, we are now limited mainly by the accuracy of the polarization efficiency modelling. Using our various tests, simulations, and comparison between different high-multipole likelihood implementations, we estimate the consistency of the results to be better than the 0.5σ level on the λCDM parameters, as well as classical single-parameter extensions for the joint likelihood (to be compared to the 0.3σ levels we achieved in 2015 for the temperature data alone on λCDM only). Minor curiosities already present in the previous releases remain, such as the differences between the best-fit λCDM parameters for the ℓ < 800 and ℓ > 800 ranges of the power spectrum, or the preference for more smoothing of the power-spectrum peaks than predicted in λCDM fits. These are shown to be driven by the temperature power spectrum and are not significantly modified by the inclusion of the polarization data. Overall, the legacy Planck CMB likelihoods provide a robust tool for constraining the cosmological model and represent a reference for future CMB observations.