We first rigourously establish, for any N ≥ 2, that the toroidal modular invariant partition functions for the (not necessarily unitary) W N ( p, q) minimal models biject onto a well-defined subset of those of the SU(N ) × SU(N ) Wess-Zumino-Witten theories at level ( p − N , q − N ). This permits considerable simplifications to the proof of the Cappelli-Itzykson-Zuber classification of Virasoro minimal models. More important, we obtain from this the complete classification of all modular invariants for the W 3 ( p, q) minimal models. All should be realised by rational conformal field theories. Previously, only those for the unitary models, i.e. W 3 ( p, p + 1), were classified. For all N our correspondence yields for free an extensive list of W N ( p, q) modular invariants. The W 3 modular invariants, like the Virasoro minimal models, all factorise into SU(3) modular invariants, but this fails in general for larger N . We also classify the SU(3) × SU(3) modular invariants, and find there a new infinite series of exceptionals.