The mechanisms by which TH17 cells can either protect barrier tissues or initiate autoimmunity remain unknown. Here we identify the transcription factor EGR2 as a key determinant of TH17 cell pathogenicity. EGR2 was found to govern TH17 cell migration, regulate the expression of pathogenicity-associated genes, and facilitate the recruitment of other immune cells in the central nervous system.