Résumé : The polarizations of prompt and non-prompt [Formula presented] and ψ(2S) mesons are measured in proton-proton collisions at s=13 TeV, using data samples collected by the CMS experiment in 2017 and 2018, corresponding to a total integrated luminosity of 103.3fb−1. Based on the analysis of the dimuon decay angular distributions in the helicity frame, the polar anisotropy, λϑ, is measured as a function of the transverse momentum, pT, of the charmonium states, in the 25–120 and 20–100 GeV ranges for the [Formula presented] and ψ(2S), respectively. The non-prompt polarizations agree with predictions based on the hypothesis that, for pT≳25GeV, the non-prompt [Formula presented] and ψ(2S) are predominantly produced in two-body B meson decays. The prompt results clearly exclude strong transverse polarizations, even for pT exceeding 30 times the [Formula presented] mass, where λϑ tends to an asymptotic value around 0.3. Taken together with previous measurements, by CMS and LHCb at s=7 TeV, the prompt polarizations show a significant variation with pT, at low pT