This document describes a method for synthesizing nitrogen-doped porous graphitic carbon materials for use as electrodes in supercapacitors. The method involves polymerizing aniline in the presence of ferric chloride, followed by high-temperature treatment and chemical activation to produce a 3D porous structure. The novel carbon material demonstrated a high specific capacitance of 300 F/g as an electrode in aqueous electrolyte. Further characterization showed the material had a surface area of over 1200 m2/g after activation.