High precision single-differential $$W^\pm $$ W ± -boson production cross-sections as a function of electron or muon transverse momentum $$p_\textrm{T}$$ p T or their pseudorapity $$\eta $$ η , as well as double-differential cross-sections as functions of these variables, are measured in proton–proton collisions at centre-of-mass energies $$\sqrt{s}=5.02$$ s = 5.02 TeV and 13 TeV. The W-boson charge asymmetry as a function of lepton $$\eta $$ η is also measured. The data, collected in dedicated runs at reduced instantaneous luminosity with the ATLAS detector at the Large Hadron Collider, correspond to integrated luminosities of 255 pb $$^{-1}$$ - 1 at 5.02 TeV and 338 pb $$^{-1}$$ - 1 at 13 TeV. The measurements are in agreement with Standard-Model predictions calculated at next-to-next-to-leading-order in the strong coupling constant $$\alpha _s$$ α s including transverse-momentum resummation at next-to-next-to-leading logarithmic accuracy using several parton distribution functions. The impact of the measured differential cross-sections as a function of lepton $$\eta $$ η on the determination of these functions is studied using a profiling technique.