Interleukin 2 (IL-2), a cytokine linked to human autoimmune disease, limits IL-17 production. Here we found that deletion of the gene encoding the transcription factor STAT3 in T cells abrogated IL-17 production and attenuated autoimmunity associated with IL-2 deficiency. Whereas STAT3 induced IL-17 and the transcription factor RORγt and inhibited the transcription factor Foxp3, IL-2 inhibited IL-17 independently of Foxp3 and RORγt. STAT3 and STAT5 bound to multiple common sites across the locus encoding IL-17. The induction of STAT5 binding by IL-2 was associated with less binding of STAT3 at these sites and the inhibition of associated active epigenetic marks. 'Titration' of the relative activation of STAT3 and STAT5 modulated the specification of cells to the IL-17-producing helper T cell (T(H)17 cell) subset. Thus, the balance rather than the absolute magnitude of these signals determined the propensity of cells to make a key inflammatory cytokine.