Hydrogen-bonded organic frameworks (HOFs) are considered as potential choice for future energy storage systems due to their adjustable chemistry, environmental benignity, and cost-effectiveness. However, the electrochemical reaction mechanisms of the HOFs remain elusive. Herein, we demonstrate the site-selective electrochemical storage of alkaline metal ions (Li+, Na+, and K+) in porphyrin-based hydrogen-bonded organic framework (PFC-72-Co). Through systematic experimental and theoretical investigations, three active sites are identified, namely, carbonyl site (site 1), porphyrin site (site 2), and interstitial site (site 3). The carbonyl functional group can accommodate all alkaline metal ions (Li+, Na+, K+), whereas the porphyrin and interstitial sites are selective only for Li+ ions. As a result, the monomer Co-TCPP, with its abundant active sites, is a promising anode material for potassium-ion batteries, hosting 7 K+ ions and delivering a reversible capacity of 247.6 mAh g-1. In contrast, the PFC-72-Co framework, owing to its low solubility in the electrolyte, serves as a stable anode for lithium-ion batteries, exhibiting ultrahigh cycling stability of over 10,000 cycles. This work provides new understanding of the electrochemical reaction mechanisms of organic materials for alkaline metal-ion batteries.