Supercavitating hydrofoils of large aspect ratio operating near a free surface are investigated, assuming an inviscid and irrotational flow with the effects of gravity and surface tension neglected. The flow near the foil, treated as two-dimensional, is solved by a nonlinear free-streamline theory, then a three-dimensional ‘downwash’ correction is made using Prandtl's lifting-line theory. The strength of the lifting-line vortex is determined by information from the two-dimensional solution through a matching procedure, in which the inverse of aspect ratio is used as a small parameter for asymptotic expansions. The analysis incorporates a free-surface reference level to determine the submergence depth of the foil. The present method can be applied to any type of foil having an arbitrary planform or profile shape, including a rounded leading edge, a twist and even a small dihedral angle, within the assumption of large aspect ratio. Numerical computations made on rectangular flat-plate hydrofoils show excellent agreement of results with existing experimental data, even for large angles of attack and relatively low aspect ratios. The pressure distributions, shapes of the cavity and free surface are also calculated as a function of spanwise position.