Maintaining physiological pH is required for survival, and exposure to alkaline chemicals such as ammonia (smelling salts) elicits severe pain and inflammation through unknown mechanisms. TRPV1, the capsaicin receptor, is an integrator of noxious stimuli including heat and extracellular acidic pH. Here, we report that ammonia activates TRPV1, TRPA1 (another polymodal nocisensor), and other unknown receptor(s) expressed in sensory neurons. Ammonia and intracellular alkalization activate TRPV1 through a mechanism that involves a cytoplasmic histidine residue, not used by other TRPV1 agonists such as heat, capsaicin or low pH. Our studies show that TRPV1 detects both acidic and basic deviations from homeostatic pH.