Numerous codes are being developed to solve shallow water equations. Because these are used in hydraulic and environmental studies, their capability to simulate flow dynamics properly is critical to guarantee infrastructure and human safety. Although validating these codes is an important issue, code validations are currently restricted because analytic solutions to the shallow water equations are rare and have been published on an individual basis over a period of more than five decades. This article aims at making analytic solutions to the shallow water equations easily available to code developers and users. It compiles a significant number of analytic solutions to the shallow water equations that are currently scattered through the literature of various scientific disciplines. The analytic solutions are described in a unified formalism to make a consistent set of test cases. These analytic solutions encompass a wide variety of flow conditions (supercritical, subcritical, shock, etc.), in one or two space dimensions, with or without rain and soil friction, for transitory flow or steady state. The corresponding source codes are made available to the community (http://www.univ-orleans.fr/mapmo/soft/SWASHES), so that users of shallow water-based models can easily find an adaptable benchmark library to validate their numerical methods. Copyright © 2012 John Wiley & Sons, Ltd.