An efficient solid-state pyrolysis route is presented to prepare boron and phosphorous-doped graphene without using the template, solvent, or catalyst. By controlling the pyrolysis temperature, selective doping of phosphorous or boron was achieved. Phosphorous-doped graphene (PDG) and boron-doped graphene (BDG) samples are obtained when pyrolysing the precursor at 700 ˚C and at 900 ˚C, respectively under autogenic pressure. PDG and BDG electrodes show a considerable oxygen reduction activity by direct four-electron pathway in alkaline medium. Further, these catalysts show improved durability under continuous oxygen reduction, resistance to methanol oxidation and CO-tolerance than the commercial catalyst. The results suggest that by tuning the reaction temperature, selective doping, and either boron or phosphorous in graphene was achieved and used as non-precious and metal-free catalysts for oxygen reduction.