We compute the large N limit of the partition function of the Euclidean Yang–Mills measure on orientable compact surfaces with genus
$g\geqslant 1$
and non-orientable compact surfaces with genus
$g\geqslant 2$
, with structure group the unitary group
${\mathrm U}(N)$
or special unitary group
${\mathrm{SU}}(N)$
. Our proofs are based on asymptotic representation theory: more specifically, we control the dimension and Casimir number of irreducible representations of
${\mathrm U}(N)$
and
${\mathrm{SU}}(N)$
when N tends to infinity. Our main technical tool, involving ‘almost flat’ Young diagram, makes rigorous the arguments used by Gross and Taylor (1993, Nuclear Phys. B400(1–3) 181–208) in the setting of QCD, and in some cases, we recover formulae given by Douglas (1995, Quantum Field Theory and String Theory (Cargèse, 1993), Vol. 328 of NATO Advanced Science Institutes Series B: Physics, Plenum, New York, pp. 119–135) and Rusakov (1993, Phys. Lett. B303(1) 95–98).