Context. In stratified atmospheres, acoustic waves can only propagate if their frequency is higher than the cutoff value. The determination of the cutoff frequency is fundamental for several topics in solar physics, such as evaluating the contribution of the acoustic waves to the chromospheric heating or the application of seismic techniques. However, different theories provide different cutoff values. Aims. We developed an alternative method to derive the cutoff frequency in several standard solar models, including various quiet-Sun and umbral atmospheres. The effects of magnetic field and radiative losses on the cutoff are examined. Methods. We performed numerical simulations of wave propagation in the solar atmosphere using the code MANCHA. The cutoff frequency is determined from the inspection of phase-difference spectra computed between the velocity signal at two atmospheric heights. The process is performed by choosing pairs of heights across all the layers between the photosphere and the chromosphere to derive the vertical stratification of the cutoff in the solar models. Result. The cutoff frequency predicted by the theoretical calculations departs significantly from the measurements obtained from the numerical simulations. In quiet-Sun atmospheres, the cutoff shows a strong dependence on the magnetic field for adiabatic wave propagation. When radiative losses are taken into account, the cutoff frequency is greatly reduced and the variation of the cutoff with the strength of the magnetic field is lower. The effect of the radiative losses in the cutoff is necessary to understand recent quiet-Sun and sunspot observations. In the presence of inclined magnetic fields, our numerical calculations confirm that the cutoff frequency is reduced as a result of the reduced gravity experienced by waves that propagate along field lines. An additional reduction is also found in regions with significant changes in the temperature, which is due to the lower temperature gradient along the path of field-guided waves. Conclusions. Our results show solid evidence that the cutoff frequency in the solar atmosphere is stratified. The cutoff values are not correctly captured by theoretical estimates. In addition, most of the widely used analytical cutoff formulae neglect the effect of magnetic fields and radiative losses, whose role is critical for determining the evanescent or propagating nature of the waves.