Oxygen reduction reaction (ORR) catalysts with hierarchical pore structures, high specific surface area and multiple heteroatoms doping is very attractive due to the rapid mass transport and abundant active sites. In this work, we reported a facile confined strategy to prepare N, P co‐doped hierarchical porous carbon (NPHC) and investigated their catalytic performance for ORR. The strategy greatly simplifies the synthesis procedure of 3D hierarchical carbon templated by SiO2, which can utilize small organic molecules as carbon sources and avoids the pre‐polymerization and post‐washing process. Moreover, this strategy can be readily extended to synthesis other carbons by simply changing the carbon sources and heteroatom sources, or to synthesize metal compounds/carbon composites by adding metal sources during the synthesis process for energy conversion and storage.