The Eliashberg theory of superconductivity accounts for the fundamental physics of conventional superconductors, including the retardation of the interaction and the Coulomb pseudopotential, to predict the critical temperature Tc. McMillan, Allen, and Dynes derived approximate closed-form expressions for the critical temperature within this theory, which depends on the electron–phonon spectral function α2F(ω). Here we show that modern machine-learning techniques can substantially improve these formulae, accounting for more general shapes of the α2F function. Using symbolic regression and the SISSO framework, together with a database of artificially generated α2F functions and numerical solutions of the Eliashberg equations, we derive a formula for Tc that performs as well as Allen–Dynes for low-Tc superconductors and substantially better for higher-Tc ones. This corrects the systematic underestimation of Tc while reproducing the physical constraints originally outlined by Allen and Dynes. This equation should replace the Allen–Dynes formula for the prediction of higher-temperature superconductors.