Heteroatom-doped carbon materials have been considered as potential substitutes for Pt-based electrocatalysts for the oxygen reduction reaction (ORR) in alkaline fuel cells. Here we report the synthesis of oxygen-containing nitrogen-doped carbon (ONC) nanosheets through the carbonization of a mixture that contained glucose and dicyandiamide (DCDA). In situ formed graphitic carbon nitride (g-C N ) derived from DCDA provided a nitrogen-rich template, thereby facilitating the formation of ONC nanosheets. The resultant ONC materials with high nitrogen content, high specific surface areas, and highly mesoporous total volume displayed excellent electrochemical performance, including a similar ORR onset potential, half-potential, a higher diffusion-limited current, and excellent tolerance to methanol than that of the commercial Pt/C catalyst, respectively. Moreover, the ONC-850 nanosheet displayed high long-term durability even after 1000 cycles as well as a high electron transfer number of 3.92 (4.0 for Pt/C). Additionally, this work provides deeper insight into these materials and a versatile strategy for the synthesis of cost-effective 2D N-doped carbon electrocatalysts.