The polarizations of prompt and non-prompt J/Ļ 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.