We introduce the flattening equation, which relates the shape of the dark halo to the angular velocity dispersions and the density of a tracer population of stars. It assumes spherical alignment of the velocity dispersion tensor, as seen in the data on stellar halo stars in the Milky Way. The angular anisotropy and gradients in the angular velocity dispersions drive the solutions towards prolateness, whilst the gradient in the stellar density is a competing effect favouring oblateness. We provide an efficient numerical algorithm to integrate the flattening equation. Using tests on mock data, we show that the there is a strong degeneracy between circular speed and flattening, which can be circumvented with informative priors. Therefore, we advocate the use of the flattening equation to test for oblateness or prolateness, though the precise value of q can only be measured with the addition of the radial Jeans equation. We apply the flattening equation to a sample extracted from the Sloan Digital Sky Survey of ∼ 15000 halo stars with full phase space information and errors. We find that between Galactocentric radii of 5 and 10 kpc, the shape of the dark halo is prolate, whilst even mildly oblate models are disfavoured. Strongly oblate models are ruled out. Specifically, for a logarithmic halo model, if the asymptotic circular speed v 0 lies between 210 and 250 kms −1 , then we find the axis ratio of the equipotentials q satisfies 1.5 q 2.