In this paper, we describe an SPH algorithm for multi-fluid flow, which is efficient, simple and robust. We derive the inviscid equations of motion from a Lagrangian together with the constraint provided by the continuity equation. The viscous flow equations then follow by adding a viscous term. Rigid boundaries are simulated using boundary force particles in a manner similar to the immersed boundary method. Each fluid is approximated as weakly compressible with a speed of sound sufficiently large to guarantee that the relative density variations are typically 1%. When the SPH force interaction is between two particles of different fluids, we increase the pressure terms. This simple procedure stabilizes the interface between the fluids. The equations of motion are integrated using a time stepping rule based on a second-order symplectic integrator. When linear and angular momentum should be conserved exactly, they are conserved to within round-off errors. We test the algorithm by simulating a variety of problems involving fluids with a density ratio in the range 1–1000. The first of these is a free surface problem with no rigid boundaries. It involves the flow of an elliptical distribution with one fluid inside the other. We show that the simulations converge as the particle spacing decreases, and the results are in good agreement with the exact inviscid, incompressible theory. The second test is similar to the first but involves the nonlinear oscillation of the fluids. As in the first test, the agreement with theory is very good, and the method converges. The third test is the simulation of waves at the interface between two fluids. The method is shown to converge, and the agreement with theory is satisfactory. The fourth test is the Rayleigh–Taylor instability for a configuration considered by other authors. Key parameters are shown to converge, and the agreement with other authors is good. The fifth and final test is how well the SPH method simulates gravity currents with density ratios in the range 2–30. The results of these simulations are in very good agreement with those of other authors and in satisfactory agreement with experimental results.Copyright © 2012 John Wiley & Sons, Ltd.