The multiplicity dependence of the pseudorapidity density of charged particles in proton–proton (pp) collisions at centre-of-mass energies sqrt{s}~=~5.02, 7 and 13 TeV measured by ALICE is reported. The analysis relies on track segments measured in the midrapidity range (|eta | < 1.5). Results are presented for inelastic events having at least one charged particle produced in the pseudorapidity interval |eta |<1. The multiplicity dependence of the pseudorapidity density of charged particles is measured with mid- and forward rapidity multiplicity estimators, the latter being less affected by autocorrelations. A detailed comparison with predictions from the PYTHIA 8 and EPOS LHC event generators is also presented. The results can be used to constrain models for particle production as a function of multiplicity in pp collisions.