Cytokines interact with their receptors in the extracellular space to control immune responses. How the physicochemical properties of the extracellular space influence cytokine signaling is incompletely elucidated. Here, we show that the activity of interleukin-2 (IL-2), a cytokine critical to T cell immunity, is profoundly affected by pH, limiting IL-2 signaling within the acidic environment of tumors. Generation of lactic acid by tumors limits STAT5 activation, effector differentiation, and antitumor immunity by CD8+ T cells and renders high-dose IL-2 therapy poorly effective. Directed evolution enabled selection of a pH-selective IL-2 mutein (Switch-2). Switch-2 binds the IL-2 receptor subunit IL-2Rα with higher affinity, triggers STAT5 activation, and drives CD8+ T cell effector function more potently at acidic pH than at neutral pH. Consequently, high-dose Switch-2 therapy induces potent immune activation and tumor rejection with reduced on-target toxicity in normal tissues. Last, we show that sensitivity to pH is a generalizable property of a diverse range of cytokines with broad relevance to immunity and immunotherapy in healthy and diseased tissues.