Contamination of phenolic compounds has devastating effects on the environment. Therefore, its harmless treatment and recycling have received extensive attention. Herein, a novel method for preparing N-S doped phenolic resin (NSPR) from phenols, N and S groups in semi-coking wastewater, and formaldehyde are developed. The KOH is consequently incorporated into the NSPR through simultaneous carbonization and activation in a single step to produce porous carbon material (NSPC). The as-obtained NSPC exhibits a high specific capacitance of 182 F g−1 at 0.5 A g−1, a high energy density of 9.1 Wh kg−1 at a power density of 0.15 kW kg−1, and remarkable cycling stability in aqueous KOH electrolyte. This outstanding electrochemical performance is attributed to its ultrahigh specific surface area (SSA, 2,523 m2 g−1), enormous total pore volume (Vt, 1.30 cm3 g−1), rational pore structure, and N-S heteroatom self-doping (0.76 at% N and 0.914 at% S), which ensures adequate charge storage, rapid electrolyte ion diffusion, and contributed pseudo-capacitance. This work not only provides a facile method for transforming phenolic wastewater into high-value products but also offers a cost-effective and high-performance porous carbon material for supercapacitors.