Using a hybrid method that combines non-radiative hydrodynamical simulations with a semianalytic model of galaxy formation, we determine the ram pressure experienced by galaxies in haloes with virial masses 12.5 ≤ log (M200/ h−1 M⊙) < 15.35 as a function of the halocentric distance, for redshifts 0 ≤ z ≤ 3. The ram pressure is calculated with a self-consistent method that uses the simulation gas particles to obtain the properties of the intergalactic medium. The ram pressure profiles obtained can be well described by beta profile models, with parameters that depend on redshift and halo virial mass in a simple fashion. The fitting formulae provided here will prove useful to include ram pressure effects into semi-analytic models based on methods that lack gas physics, such as dark-matter-only simulations or the Press–Schechter formalism.