Nitrogen-doped mesoporous carbon (NMC) was synthesized via pyrolysis of cobalt-containing casein obtained by extraction from pure milk with the auxiliary of cobalt ions. The cobalt element in casein promoted specific surface area and N element doping amount of casein-derived porous carbon. The N-doped porous carbon obtained by carbonization at 800°C (NPC-800) possessed a specific surface area of ∼886.7m2 g−1, and the mesoporous size was centered at 2.7 and 7nm. X-ray photoelectron spectroscopy analysis showed that the nitrogen content of NPC-800 was 3.29 at%. The NPC-800 was explored as a symmetric supercapacitor, which exhibited specific capacity of 380Fg−1 at a current density of 0.5Ag−1, 218Fg−1 at a current density of 20Ag−1, and high capacitance retention of 91.3% after charging/discharging 5,000 cycles.