Metal-free N–S- and N–P-doped nanocarbon (SCNP and PCNP) electrocatalysts prepared through sustainable microwaveassisted synthesis using hemigraphis alternata plant leaves. The prepared heteroatom-doped nanocarbon materials are active catalysts for the two-electron oxygen reduction reaction (ORR) to produce 65–70% of hydrogen peroxide. As evidenced from the XPS, most proportion of the doped heteroatoms contain the oxygen functional groups in the nanocarbons. These attributes are the critical factors to see the selective two-electron transfer ORR for the PCNP and SCNP. This approach shed light on the critical role of dual heteroatoms doping and the oxygen functionalities in nanocarbon towards the selectivity of ORR. We believe that this method would allow the preparation of heteroatom that contains oxygen functionalities. Our work paves a sustainable way of preparation of nanocarbon based ORR catalysts that are only selective for two-electron transfer process.