The external boundary typically has an arbitrary shape. The Dupuis formula obtained by circular approximation of a closed external boundary is usually used to determine the flow rate of a hydrodynamically perfect well. The paper proposes an elliptical approximation in which the wellhead may be located anywhere inside the bounding ellipse. The purpose of the study is to obtain a formula for calculating the well flow rate during elliptical approximation of the external boundary. Objects of study: a vertical well surrounded by an arbitrary external boundary. Research methods: differential and integral calculus. Results: formula for the flow rate of hydrodynamically perfect well is obtained based on known characteristics of formation, flowing fluid and parameters of an ellipse approximating the external boundary; an example is given showing the difference between the flow rates counted according to this formula and the Dupuis formula, which is its special case.