Using the coal tar pitch as the carbon precursor, ammonium sulfate as the foaming agent and nitrogen source, and KOH as theactivator.Nitrogen-doped three-dimensional structured porous carbon was prepared by chemical foaming coupled with KOH activation.The microstructure and heteroatom content of coal tar pitch based porous carbon were controlled by adjusting the alkali carbon ratio and theeffects of alkali carbon ratio and heteroatom content on the performance of porous carbon were investigated. The structure and compositionof the materials were characterized by SEM, XPS, and N2 adsorption and desorption, and the electrochemical properties of the materialswere evaluated with Galvanostatic Charge-Discharge, Cyclic Voltammetry, and Electrochemical Impedance Spectroscopy. The results showthat chemical foaming coupled with KOH activation not only optimizes the internal pores to form a hierarchical pore structure and dopesthe carbon skeleton with an appropriate amount of heteroatoms, but also effectively improves the electrochemical performance of the por⁃ous carbon under the dual effect. The optimized NPC-2 shows a high specific surface area (1 636 m2 / g), abundant nitrogen (5.27%),and mutually cross-linked nitrogen - doped carbon skeleton. In the three - electrode system, the NPC - 2 electrode material obtains ahigh mass specific capacitance with a mass specific capacitance of 374.2 F/ g at a current density of 0.5 A/ g; when the current density isas high as 100 A/ g, its mass specific capacitance can still reach 249.5 F/ g and the capacitance retention rate can reach 66.7%, showingexcellent electrochemical performance. This excellent performance is derived from the well-developed graded pore structure and excel⁃lent carbon conductive network.