We use three-dimensional SPH/N-body simulations to study ram pressure stripping of gas from spiral galaxies orbiting in clusters. We find that the analytic expectation of Gunn & Gott, relating the gravitational restoring force provided by the disc to the ram pressure force, provides a good approximation to the radius at which gas will be stripped from a galaxy. However, at small radii it is also important to consider the potential provided by the bulge component. A spiral galaxy passing through the core of a rich cluster, such as Coma, will have its gaseous disc truncated to ∼4 kpc, thus losing ∼80 per cent of its diffuse gas mass. The time-scale for this to occur is a fraction of a crossing time ∼107 yr. Galaxies orbiting within poorer clusters, or inclined to the direction of motion through the intracluster medium, will lose significantly less gas. We conclude that ram pressure alone is insufficient to account for the rapid and widespread truncation of star formation observed in cluster galaxies, or the morphological transformation of Sabs to S0s that is necessary to explain the Butcher–Oemler effect.