The small-x gluon in global fits of parton distributions is affected by large uncertainties from the lack of direct experimental constraints. In this work we provide a precision determination of the small-x gluon from the exploitation of forward charm production data provided by LHCb for three different centre-of-mass (CoM) energies: 5 TeV, 7 TeV and 13 TeV. The LHCb measurements are included in the PDF fit by means of normalized distributions and cross-section ratios between data taken at different CoM values, R 13/7 and R 13/5 . We demonstrate that forward charm production leads to a reduction of the PDF uncertainties of the gluon down to x ≃ 10 −6 by up to an order of magnitude, with implications for high-energy colliders, cosmic ray physics and neutrino astronomy.