Hydrogen peroxide (H2O2) is an essential chemical that is widely used in chemical synthesis, pulp and paper bleaching, and water treatments. Nearly, 95% of current H2O2 is produced by the energy-intensive and expensive anthraquinone process. Electrosynthesis of H2O2 via the 2e− oxygen reduction reaction (ORR) has emerged as a promising alternative to the anthraquinone process that allows for environmentally benign, continuous, and on-site production of H2O2 from clean sources (air and water). While carbon nanomaterials have demonstrated promising activity and selectivity for H2O2 production, the lack of understanding of the catalytic active sites and key structural factors has remained a challenge. In this work, we have prepared a series of graphitic ordered mesoporous carbon (GOMC) model catalysts to investigate the active oxygen functional groups and structural factors. We have identified that the carboxyl (C–OOH) groups located at the graphitic edge carbon sites are the major active sites for the 2e− ORR and the carbonyl (C=O) groups are secondary active sites. The nanoporous carbon catalyst with abundant active edge sites and optimized structure exhibited the best H2O2 electrosynthesis performance among the reported carbon-based catalysts and excellent long-term stability (7 days) with near 100% H2O2 faradaic efficiency.