The standard model of particle physics encapsulates our best current understanding of physics at the smallest scales. A fundamental axiom of this theory is the universality of the couplings of the different generations of leptons to the electroweak gauge bosons. The measurement of the ratio of the decay rate of W bosons to τ leptons and muons, R(τ/μ), constitutes an important test of this axiom. Using 139 fb−1 of proton–proton collisions recorded with the ATLAS detector at a centre-of-mass energy of 13 TeV, we report a measurement of this quantity from di-leptonic tt¯ events where the top quarks decay into a W boson and a bottom quark. We can distinguish muons originating from W bosons and those originating from an intermediate τ lepton through the muon transverse impact parameter and differences in the muon transverse momentum spectra. The measured value of R(τ/μ) is 0.992 ± 0.013 [± 0.007(stat) ± 0.011(syst)] and is in agreement with the hypothesis of universal lepton couplings as postulated in the standard model. This is the only such measurement from the Large Hadron Collider, so far, and obtains twice the precision of previous measurements.