Understanding the gating mechanism of ion channel proteins is key to understanding the regulation of cell signaling through these channels. Channel opening and closing are regulated by diverse environmental factors that include temperature, electrical voltage across the channel, and proton concentration. Low permeability in voltage-gated potassium ion channels (Kv) is intimately correlated with the prolonged action potential duration observed in many acidosis diseases. The Kv channels consist of voltage-sensing domains (S1-S4 helices) and central pore domains (S5-S6 helices) that include a selectivity filter and water-filled cavity. The voltage-sensing domain is responsible for the voltage-gating of Kv channels. While the low permeability of Kv channels to potassium ion is highly correlated with the cellular proton concentration, it is unclear how an intracellular acidic condition drives their closure, which may indicate an additional pH-dependent gating mechanism of the Kv family. Here, we show that two residues E327 and H418 in the proximity of the water cavity of Kv1.2 play crucial roles as a pH switch. In addition, we present a structural and molecular concept of the pH-dependent gating of Kv1.2 in atomic detail, showing that the protonation of E327 and H418 disrupts the electrostatic balance around the S6 helices, which leads to a straightening transition in the shape of their axes and causes dewetting of the water-filled cavity and closure of the channel. Our work offers a conceptual advancement to the regulation of the pH-dependent gating of various voltage-gated ion channels and their related biological functions.