In this work, the nitrogen-doped carbon materials (NCM) and nitrogen/sulfur codoped carbon materials (NSCM) were prepared using conventional benzoxazine (BOZ) and sulfur-containing benzoxazine as precursor and SBA-15 as template. The morphology, structure, and electrochemical performance of carbon materials were characterized by scanning electron microscopy, transmission electron microscopy, the X-ray diffraction, X-ray photoelectron spectroscopy, nitrogen adsorption–desorption, cyclic voltammetry, and galvanostatic charge–discharge. The results show that the as-prepared carbon materials have ordered mesoporous structure, large specific surface area, and excellent electrochemical properties. The NSCM treated at 800 °C exhibit an extremely high specific capacitance of 550 F/g at the current density of 0.5 A/g in 0.5 mol H2SO4 electrolyte, which shows great improvement compared with NCM. The nitrogen/sulfur codoping is suggested to be a very effective method to improve the performance of carbon materials, and the NSCM should be a promising candidate as electrode materials for supercapacitors.