We present constraints on the tensor-to-scalar ratio r using Planck data. We use the latest release of Planck maps (PR4), processed with the NPIPE code, which produces calibrated frequency maps in temperature and polarization for all Planck channels from 30 GHz to 857 GHz using the same pipeline. We compute constraints on r using the BB angular power spectrum, and also discuss constraints coming from the TT spectrum. Given Planck's noise level, the TT spectrum gives constraints on r that are cosmic-variance limited (with σ(r)=0.093), but we show that the marginalized posterior peaks toward negative values of r at about the 1.2σ level. We derive Planck constraints using the BB power spectrum at both large angular scales (the "reionization bump") and intermediate angular scales (the "recombination bump") from ℓ=2 to 150, and find a stronger constraint than that from TT, with σ(r)=0.069. The Planck BB spectrum shows no systematic bias, and is compatible with zero, given both the statistical noise and the systematic uncertainties. The likelihood analysis using B modes yields the constraint r<0.158 at 95% confidence using more than 50% of the sky. This upper limit tightens to r<0.069 when Planck EE, BB, and EB power spectra are combined consistently, and tightens further to r<0.056 when the Planck TT power spectrum is included in the combination. Finally, combining Planck with BICEP2/Keck 2015 data yields an upper limit of r<0.044.