Measurements of the differential production cross-sections of prompt and non-prompt 𝐽/𝜓 and 𝜓(2S) mesons with transverse momenta between 8 and 360 GeV and rapidity in the range |𝑦|<2 are reported. Furthermore, measurements of the non-prompt fractions of 𝐽/𝜓 and 𝜓(2S), and the prompt and non-prompt 𝜓(2S)-to-𝐽/𝜓 production ratios, are presented. The analysis is performed using 140 fb−1 of √𝑠=13 TeV pp collision data recorded by the ATLAS detector at the LHC during the years 2015–2018.