Thin-film solar cells based on the semiconductor Cu2ZnSnS4 (CZTS) are a promising candidate for terawatt-scale renewable energy generation. While CZTS is composed of earth abundant and non-toxic elements, arranged in the kesterite crystal structure, there is a synthetic challenge to produce high-quality stoichiometric materials over large areas. We calculate the thermodynamic potentials of CZTS and its elemental and binary components based on energetic and vibrational data computed using density functional theory. These chemical potentials are combined to produce a thermodynamic model for the stability of CZTS under arbitrary temperatures and pressures, which provide insights into the materials chemistry. CZTS was shown to be thermodynamically stable with respect to its component elements and their major binary phases binaries under modest partial pressures of sulfur and temperatures below 1100 K. Under near-vacuum conditions with sulfur partial pressures below 1 Pa decomposition into binaries including solid SnS becomes favourable, with a strongly temperature-dependent stability window.