The direct electrochemical synthesis of H2O2 from O2 is currently the most promising alternative to energy-intensive industrial anthraquinone oxidation/reduction methods. However, its widespread use is hampered by the lack of efficient low-cost electrocatalysts. In the current study, oxygenated boron-doped carbon (O-BC) materials were realized via a green synthetic strategy involving polymer dehalogenation and employed as electrode materials for the electrochemical synthesis of H2O2via a 2e− oxygen reduction. The catalytic activity of the O-BC materials was optimized through systematic variation of the boron source (H3BO3) dosage and annealing temperature. Electrochemical measurements revealed that the optimal sample (O-BC-2-650) exhibited a selectivity of 98% for the 2e− oxygen reduction to H2O2 and an average H2O2 production rate of 412.8 mmol gcat−1 h−1 in an H-type alkaline electrolyzer. Density functional theory simulations indicated that the functionalization of active B sites with one oxygen atom provides the lowest Gibbs free energy change (ΔG) of 0.03 eV for the hydrogenation of *O2, while functionalization with zero or two O atoms results in much larger ΔG values (0.08 and 0.10 eV, respectively). Thus, this work details a new type of green, low-cost, and metal-free electrocatalyst for H2O2 production.