We present a compact finite differences method for the calculation of two-dimensional viscous flows in biological fluid dynamics applications. This is achieved by using body-forces that allow for the imposition of boundary conditions in an immersed moving boundary that does not coincide with the computational grid. The unsteady, incompressible Navier–Stokes equations are solved in a Cartesian staggered grid with fourth-order Runge–Kutta temporal discretization and fourth-order compact schemes for spatial discretization, used to achieve highly accurate calculations. Special attention is given to the interpolation schemes on the boundary of the immersed body. The accuracy of the immersed boundary solver is verified through grid convergence studies. Validation of the method is done by comparison with reference experimental results. In order to demonstrate the application of the method, 2D small insect hovering flight is calculated and compared with available experimental and computational results. Copyright © 2009 John Wiley & Sons, Ltd.