In this work, we present a new nanocasting strategy for the synthesis of highly active, selective and stable N-doped ordered mesoporous carbon electrocatalysts for the CP-868596 of O2 to H2O2. The synthesis method is based on the use of two inexpensive and readily available carbon precursors, i.e. aniline and dihydroxynaphthalene (DHN), which are sequentially introduced into the pores of mesoporous SBA-15 silica as a hard template. In our strategy, the pores of SBA-15 are covered with a monolayer of aniline, which is then polymerised and pyrolysed, followed by filling of the remaining pores space with dihydroxynaphthalene, by another pyrolysis step and finally by the removal of the silica template ( Fig. 1). In this way, N-doping will be limited to the surface of the material. DHN was chosen to complete the filling of the pores of the SBA-15 template because it has an extensive aromatic structure, with the target of favouring the formation of a graphitic structure, and because its hydroxyl groups can easily interact with N through hydrogen bridges. The two hydroxyl groups can also react with the SBA-15 silanol groups that might still be available, leading to grafting of the aromatic species through a dehydration reaction . Two NOMC materials were prepared by tuning the amount of DHN employed in the synthesis. The obtained materials presented the desired array of parallel channels leading to high specific surface area (up to 877 m2 g−1) and displayed excellent electrocatalytic properties in the oxygen reduction reaction to H2O2.