Nanoporous carbons with high surface area are achieved through direct carbonization of a commercially available zeolitic imidazolate framework (ZIF-8) without any additional carbon sources. The resultant nanoporous carbons exhibit high electrochemical capacitances in an acidic aqueous electrolyte.