• A novel micellar co-polymerization strategy enables the synthesis of P, N co-doped hollow carbon nanospheres with a unique pore structure and defect-rich framework.
• The combined effect of graphitic nitrogen and phosphorus-carbon bonds modulates the local electronic structure of adjacent carbon atoms, facilitating electron transfer for enhanced HER.
• The optimized HCN catalyst carbonized at 1100 °C exhibits superior HER activity and outstanding stability (70 h at 10 mA cm−2) in alkaline water.
• This work provides a promising metal-free catalyst design for efficient and durable hydrogen production via alkaline water electrolysis.