CD4+ T-helper cells producing interleukin-17 (IL-17), known as T-helper 17 (TH17) cells, comprise heterogeneous subsets that exhibit distinct pathogenicity. Although pathogenic and non-pathogenic TH17 subsets share a common RORγt-dependent TH17 transcriptional programme, transcriptional regulatory mechanisms specific to each of these subsets are mostly unknown. Here we show that the AP-1 transcription factor JunB is critical for TH17 pathogenicity. JunB, which is induced by IL-6, is essential for expression of RORγt and IL-23 receptor by facilitating DNA binding of BATF at the Rorc locus in IL-23-dependent pathogenic TH17 cells, but not in TGF-β1-dependent non-pathogenic TH17 cells. Junb-deficient T cells fail to induce TH17-mediated autoimmune encephalomyelitis and colitis. However, JunB deficiency does not affect the abundance of gut-resident non-pathogenic TH17 cells. The selective requirement of JunB for IL-23-dependent TH17 pathogenicity suggests that the JunB-dependent pathway may be a therapeutic target for autoimmune diseases.