Nitrogen and sulfur dual-doped mesoporous carbons (NSMCs) have been fabricated through a facile template-mediated pyrolyzing method using poly(ethyleneimine) (PEI) as sources of nitrogen (N) and carbon (C), ferrous sulfate(FeSO4 7H2O) as both precursor of sulfur (S) and activation reagent along with nanoscaled silica as sacrificial supports. The composition, morphology, and microstructure of the products are characterized using X-ray diffraction, scanning electron microscopy, nitrogen sorption analysis and X-ray photoelectron spectroscopy. It reveals that these NSMCs possess a BET surface area over 1064m2 g−1and abundant mesoporous structure with pore size ranged from 4 to 20nm. The atomic percentages of N and S functionalities are found to be 4.00at.% N and 0.83at.% S, indication of successful incorporation of both nitrogenand sulfur into carbon network. Benefiting from the aforementioned characteristics, these NSMCs show perfect supercapacitive performances, which have been demonstrated by cyclic voltammetry and constant-current charge/discharge cycling techniques. In 0.5M H2SO4 electrolyte, the specific capacitance (SC) of the as-prepared NSMCs electrode can reach 280F/g at a current density of 1A/g. Even at a high rate capability of 100A/g, the NSMCs electrode still shows the SC value as high as 232F/g, retaining 83% of that at 1A/g. Also, the electrode exhibits excellent charge/discharge cycling stability, and no measurable capacitance losses is observed even after 5000 cycles, making them potentially promising for high-performance energy storage devices.