The N2 absorption/desorption isotherms (Fig. 3A) of all the three samples showed typical type IV sorption curves with two high uptakes(P/P0 < 0.01, P/P0 > 0.97) and a hysteresis loop (0.40 < P/ P0 < 0.90), indicating the coexistence of micropores (50nm). Theporesizedistributions calculated by using nonlinear density functional theory (NLDFT) (Fig. 3B) also clearly showed that all samples had hierarchically porous structure involving a series of micro-, meso, macro-pores (0.55–100nm). The hierarchically porous architecture could provide short and facial transfer channels for electrolyte ions to enhance electrochemical performance. Moreover, compared to NPHC-1 and NHC, NPHC showed the highest specific surface area of 457.9m2g−1 (Table S1) calculated by the Brunauer–Emmett–Teller (BET) method. The more micropore area could be created with the increasing phosphorus interacting with carbon by CePeO defects. In addition, it also showed more extensive pore distribution, due to the weak space confinement of magadiite.