Various kinds of phenol-formaldehyde resins modified with urea have been firstly designed and synthesized; next, nitrogendoped carbon nanosheets with porous features are fabricated by a template-assisted carbonization method, using the resin as nitrogen and carbon sources, and commercial Mg(OH) 2 as template. Increasing the initial molar ratio of urea results in promoting porosity and N content. When a molar ratio of phenol and urea of 1 : 2 is employed, the resulting carbon nanosheets exhibit a large S BET (1503 m 2 g À 1 ), high pore volume (3.37 cm 3 g À 1 ) and high N doping (6.44 %). Moreover, the material delivers a remarkably improved capacitive performances with a high rate capability up to 81.27 % (pristine material: 27.31 %) and excellent cycling stability up to 119.1 % (pristine material: 88.5 %). Energy densities of up to 4.30 Wh kg À 1 (6.0 M KOH) and 10.42 Wh kg À 1 (1.0 M Na 2 SO 4 ) are found, which are almost 2.70 and 6.61 fold compared to that of the pristine one. The present resin-based synthesis strategy can be extended to other systems and opens up an avenue for producing N-doped carbon materials for supercapacitor applications.