The method of smoothed particle hydrodynamics (SPH) has recently been applied to computational geomechanics and has been shown to be a powerful alternative to the standard numerical method, that is, the finite element method, for handling large deformation and post-failure of geomaterials. However, very few studies apply the SPH method to model saturated or submerged soil problems. Our recent studies of this matter revealed that significant errors may be made if the gradient of the pore-water pressure is handled using the standard SPH formulation. To overcome this problem and to enhance the SPH applications to computational geomechanics, this article proposes a general SPH formulation, which can be applied straightforwardly to dry and saturated soils. For simplicity, the current work assumes hydrostatic pore-water pressure. It is shown that the proposed formulation can remove the numerical error mentioned earlier. Moreover, this formulation automatically satisfies the dynamic boundary conditions at a submerged ground surface, thereby saving computational cost. Discussions on the applications of the standard and new SPH formulations are also given through some numerical tests. Furthermore, techniques to obtain the correct SPH solution are also proposed and discussed throughout. As an application of the proposed method, the effect of the dilatancy angle on the failure mechanism of a two-sided embankment subjected to a high groundwater table is presented and compared with that of other solutions. Finally, the proposed formulation can be considered a basic formulation for further developments of SPH for saturated soils. Copyright © 2011 John Wiley & Sons, Ltd.