The locomotion of a body through an inviscid incompressible fluid, such that the flow remains irrotational everywhere, is known to depend on inertial forces and on both the shape and the mass distribution of the body. In this paper we consider the influence of fluid viscosity on such inertial modes of locomotion. In particular we consider a free body of variable shape and study the centre-of-mass and centre-of-volume variations caused by a shifting mass distribution. We call this recoil locomotion. Numerical solutions of a finite body indicate that the mechanism is ineffective in Stokes flow but that viscosity can significantly increase the swimming speed above the inviscid value once Reynolds numbers are in the intermediate range 50–300. To study the problem analytically, a model which is an analogue of Taylor's swimming sheet is introduced. The model admits analysis at fixed, arbitrarily large Reynolds number for deformations of sufficiently small amplitude. The analysis confirms the significant increase of swimming velocity above the inviscid value at intermediate Reynolds numbers.