Pomelo peel, a waste biomass, was used as an all-in-one (carbon source, self-template, and heteroatom) precursor to develop a nanoporous N/C-electrocatalyst for highly selective and energy-saving H2O2 production, in which disordered carbonous defects and five-membered rings (pyrrolic-N) played vital roles.