In asteroseismology, the surface effect refers to a disparity between the observed and the modelled frequencies in stars with solar-like oscillations. It originates from improper modelling of the surface layers. Correcting the surface effect usually requires using functions with free parameters, which are conventionally fitted to the observed frequencies. On the basis that the correction should vary smoothly across the H–R diagram, we parameterize it as a simple function of surface gravity, effective temperature, and metallicity. We determine this function by fitting a wide range of stars. The absolute amount of the surface correction decreases with luminosity, but the ratio between it and νmax increases, suggesting the surface effect is more important for red giants than dwarfs. Applying the prescription can eliminate unrealistic surface correction, which improves parameter estimations with stellar modelling. Using two open clusters, we found a reduction of scatter in the model-derived ages for each star in the same cluster. As an important application, we provide a new revision for the Δν scaling relation that, for the first time, accounts for the surface correction. The values of the correction factor, fΔν, are up to 2 per cent smaller than those determined without the surface effect considered, suggesting decreases of up to 4 per cent in radii and up to 8 per cent in masses when using the asteroseismic scaling relations. This revision brings the asteroseismic properties into an agreement with those determined from eclipsing binaries. The new correction factor and the stellar models with the corrected frequencies are available at https://www.github.com/parallelpro/surface.