  Next-to-leading-order (NLO) quantum electrodynamics (QED) corrections to the
production of muon and tau pairs in photon-photon collisions,
$\gamma\gamma\to\mu^{+}\mu^{-},\tau^{+}\tau^{-}$, are calculated in the
equivalent photon approximation. We mostly consider $\gamma\gamma$ processes in
ultraperipheral collisions of hadrons at the LHC, but the
$\gamma\gamma\to\tau^{+}\tau^{-}$ process in $\mathrm{e}^+\mathrm{e}^-$
collisions at LEP is also discussed. The NLO terms are found to modify the
total cross sections by up to 5%, increasing the tails of the dilepton
acoplanarity and transverse momentum distributions, and depleting by up to 15%
the yields at high masses, with respect to the leading-order predictions
including the very small virtuality of the colliding photons. At the LHC, the
calculations obtained with the charge form factor for protons and lead ions
including the NLO QED corrections improve the data--theory agreement for all
measured differential distributions, and prove an indispensable ingredient for
the extraction of precision quantities in photon-photon processes, such as the
anomalous magnetic moment of the tau lepton.
