A nitrogen-containing polymer of intrinsic microporosity (PIM-EA-TB-H2 ; nitrogen adsorption surface area 846 m 2 g −1) is vacuum carbonized at 700 • C and thereby directly without post-treatment converted into a microporous heterocarbon (cPIM; N2 adsorption surface area 425 m 2 g −1). Nitrogen functional-ities in the polymer backbone are retained in the heterocarbon and appear responsible for unusual time-, electrolyte-, and pH-dependent properties. Electrochemical characterization suggests a high specific capacitance (typically 50 F g −1) but only after prolonged immersion in aqueous HClO4. The timedependent increase in capacitance during immersion is assigned to slow hydration and ingress of HClO4 into hydrophobic micropores (H2 SO4 or H3 PO4 are more hydrophilic and much less effective). Once hydrated, the microporous heterocarbon exhibits pH-dependent capacitance "switching" over a wide pH range and analytical applications as "capacitive" pH sensor are proposed. .