The study of (anti-)deuteron production in pp collisions has proven to be a powerful tool to investigate the formation mechanism of loosely bound states in high-energy hadronic collisions. In this paper the production of (anti-)deuterons is studied as a function of the charged particle multiplicity in inelastic pp collisions at s=13 TeV using the ALICE experiment. Thanks to the large number of accumulated minimum bias events, it has been possible to measure (anti-)deuteron production in pp collisions up to the same charged particle multiplicity (d Nch/ d η∼ 26) as measured in p–Pb collisions at similar centre-of-mass energies. Within the uncertainties, the deuteron yield in pp collisions resembles the one in p–Pb interactions, suggesting a common formation mechanism behind the production of light nuclei in hadronic interactions. In this context the measurements are compared with the expectations of coalescence and statistical hadronisation models (SHM).