Porous carbons have been widely used as electrode material for supercapacitors. However, commercial porous carbons, such as activated carbons, have low electrochemical performance. Nitrogen-doping is one of the most promising strategies to improve electrochemical performance of porous carbons. In this study, nitrogen self-doped porous carbon (NPC) is prepared from melamine foam by carbonization to improve the supercapacitive performance. The prepared NPC is characterized in terms of the chemical structures and elements, morphology, pore structures, and electrochemical performance. The results of the N2 physisorption measurement, X-ray diffraction, and Raman analyses reveal that the prepared NPC has bimodal pore structures and pseudo-graphite structures with nitrogen functionality. The NPC-based electrode exhibits a gravimetric capacitance of 153 F g−1 at 1 A g−1, a rate capability of 73.2 % at 10 A g−1, and an outstanding cycling ability of 97.85% after 10,000 cycles at 10 A g−1. Thus, the NPC prepared in this study can be applied as electrode material for high-performance supercapacitors.