Nitrogen and sulfur dual-doped mesoporous carbons were prepared 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 as-prepared doped mesoporous carbons show perfect supercapacitive performances, which have been demonstrated by cyclic voltammetry and constant-current charge/discharge cycling techniques. The specific capacitance (SC) of the as-prepared electrode can reach 279 F/g at a current density of 1 A/g. Even at a high rate capability of 100 A/g, the electrode still shows the SC value as high as 240 F/g, retaining 86% of that at 1 A/g. Regarding the effect of electrolyte concentrations (1-6M KOH), 3 M KOH gives the best performance. The above results indicate that the doped mesoporous carbon electrodes developed in this work are promising for use in energy storage devices.