The features of a carbon substrate are crucial for the electrochemical performance of lithium-sulfur (Li-S) batteries. Nitrogen doping of carbon materials is assumed to play an important role in sulfur immobilisation. In this study, natural silk fibroin protein is used as a precursor of nitrogen-rich carbon to fabricate a novel, porous, nitrogen-doped carbon material through facile carbonisation and activation. Porous carbon, with a reversible capacity of 815 mA h g(-1) at 0.2 C after 60 cycles, serves as the cathode material in Li-S batteries. Porous carbon retains a reversible capacity of 567 mA h g(-1), which corresponds to a capacity retention of 98% at 1 C after 200 cycles. The promising electrochemical performance of porous carbon is attributed to its mesoporous structure, high specific surface area and nitrogen doping into the carbon skeleton. This study provides a general strategy to synthesise nitrogen-doped carbons with a high specific surface area, which is crucial to improve the energy density and electrochemical performance of Li-S batteries.