T helper 17 (Th17) cell plasticity contributes to both immunity and autoimmunity; however, the factors that control lineage flexibility are mostly unknown. Here we show the activator protein-1 (AP-1) factor JunB is an essential regulator of Th17 cell identity. JunB activates expression of Th17 lineage-specifying genes and coordinately represses genes controlling Th1 and regulatory T-cell fate. JunB supports Th17 cell identity by regulating key AP-1 complex constituents. In particular, JunB limits the expression of the subset repressor IRF8, and impedes access of JunD to regulatory regions of alternative effector loci. Although dispensable for homeostatic Th17 cell development, JunB is required for induction and maintenance of Th17 effector responses in the inflammatory contexts of both acute infection and chronic autoimmunity in mice. Through regulatory network analysis, we show that JunB is a core regulator of global transcriptional programs that promote Th17 cell identity and restrict alternative CD4(+) T-cell potential.AP-1 family transcription factors regulate CD4(+) T helper cell differentiation. Here the authors show that the AP-1 member JunB is a nonredundant regulator of transcriptional programs that support Th17 cell identity and restrain alternative Th1 and Treg cell fates in inflammatory contexts of acute fungal infection and chronic autoimmunity.