Th cells integrate signals from their microenvironment to acquire distinct specialization programs for efficient clearance of diverse pathogens or for immunotolerance. Ionic signals have recently been demonstrated to affect T cell polarization and function. Sodium chloride (NaCl) was proposed to accumulate in peripheral tissues upon dietary intake and to promote autoimmunity via the Th17 cell axis. Here, we demonstrate that high-NaCl conditions induced a stable, pathogen-specific, antiinflammatory Th17 cell fate in human T cells in vitro. The p38/MAPK pathway, involving NFAT5 and SGK1, regulated FoxP3 and IL-17A expression in high-NaCl conditions. The NaCl-induced acquisition of an antiinflammatory Th17 cell fate was confirmed in vivo in an experimental autoimmune encephalomyelitis (EAE) mouse model, which demonstrated strongly reduced disease symptoms upon transfer of T cells polarized in high-NaCl conditions. However, NaCl was coopted to promote murine and human Th17 cell pathogenicity, if T cell stimulation occurred in a proinflammatory and TGF-β-low cytokine microenvironment. Taken together, our findings reveal a context-dependent, dichotomous role for NaCl in shaping Th17 cell pathogenicity. NaCl might therefore prove beneficial for the treatment of chronic inflammatory diseases in combination with cytokine-blocking drugs.