The mammalian sensory system is capable of discriminating thermal stimuli ranging from noxious cold to noxious heat. Principal temperature sensors belong to the TRP cation channel family, but the mechanisms underlying the marked temperature sensitivity of opening and closing ('gating') of these channels are unknown. Here we show that temperature sensing is tightly linked to voltage-dependent gating in the cold-sensitive channel TRPM8 and the heat-sensitive channel TRPV1. Both channels are activated upon depolarization, and changes in temperature result in graded shifts of their voltage-dependent activation curves. The chemical agonists menthol (TRPM8) and capsaicin (TRPV1) function as gating modifiers, shifting activation curves towards physiological membrane potentials. Kinetic analysis of gating at different temperatures indicates that temperature sensitivity in TRPM8 and TRPV1 arises from a tenfold difference in the activation energies associated with voltage-dependent opening and closing. Our results suggest a simple unifying principle that explains both cold and heat sensitivity in TRP channels.