In this paper, an iterative boundary element method (IBEM) for both 2-D and 3-D cavitating hydrofoils moving steadily inside a numerical wave tank (NWT) is presented and some extensive numerical results are given. The cavitating hydrofoil part, the free surface part and the wall parts of NWT are solved separately, with the effects of one on the others being accounted for in an iterative manner. The cavitating hydrofoil surface, the free surface, the bottom surface and the side walls are modelled by a low-order potential based panel method using constant strength dipole and source panels. Second-order correction on the free surface in 2-D are included into the calculations by the method of small perturbation expansion both for potential and for wave elevation. The source strengths on the free surface are expressed in terms of perturbation potential by applying first-order (linearized) and second-order free surface conditions. The IBEM is applied to a 2-D (NACA16006 and NACA0012) and a 3-D rectangular cavitating hydrofoil and the effect of number of iterations, the effect of the depth of the hydrofoil from finite bottom and the effect of the walls of NWT, on the results are discussed.