A Weyl arrangement is the arrangement defined by the root system of a finite Weyl group. When a set of positive roots is an ideal in the root poset, we call the corresponding arrangement an ideal subarrangement. Our main theorem asserts that any ideal subarrangement is a free arrangement and that its exponents are given by the dual partition of the height distribution, which was conjectured by Sommers-Tymoczko. In particular, when an ideal subarrangement is equal to the entire Weyl arrangement, our main theorem yields the celebrated formula by Shapiro, Steinberg, Kostant, and Macdonald. Our proof of the main theorem heavily depends on the theory of free arrangements and thus greatly differs from the earlier proofs of the formula.