T helper cells that produce IL-17 (T(H)17 cells) promote autoimmunity in mice and have been implicated in the pathogenesis of human inflammatory diseases. At mucosal surfaces, T(H)17 cells are thought to protect the host from infection, whereas regulatory T (T(reg)) cells control immune responses and inflammation triggered by the resident microflora. Differentiation of both cell types requires transforming growth factor-beta (TGF-beta), but depends on distinct transcription factors: RORgammat (encoded by Rorc(gammat)) for T(H)17 cells and Foxp3 for T(reg) cells. How TGF-beta regulates the differentiation of T cells with opposing activities has been perplexing. Here we demonstrate that, together with pro-inflammatory cytokines, TGF-beta orchestrates T(H)17 cell differentiation in a concentration-dependent manner. At low concentrations, TGF-beta synergizes with interleukin (IL)-6 and IL-21 (refs 9-11) to promote IL-23 receptor (Il23r) expression, favouring T(H)17 cell differentiation. High concentrations of TGF-beta repress IL23r expression and favour Foxp3+ T(reg) cells. RORgammat and Foxp3 are co-expressed in naive CD4+ T cells exposed to TGF-beta and in a subset of T cells in the small intestinal lamina propria of the mouse. In vitro, TGF-beta-induced Foxp3 inhibits RORgammat function, at least in part through their interaction. Accordingly, lamina propria T cells that co-express both transcription factors produce less IL-17 (also known as IL-17a) than those that express RORgammat alone. IL-6, IL-21 and IL-23 relieve Foxp3-mediated inhibition of RORgammat, thereby promoting T(H)17 cell differentiation. Therefore, the decision of antigen-stimulated cells to differentiate into either T(H)17 or T(reg) cells depends on the cytokine-regulated balance of RORgammat and Foxp3.