Despite the good progress in developing doped carbon catalysts for oxygen–reduction reaction (ORR), the current metal-free carbon catalysts are still far from satisfactory for large-scale applications of fuel cell. Developing new metal free doped carbon materials with abundance active sites as well as excellent electron transfer and reactant transport rate towards ORR may be a potential solution. Herein, we develop a novel three-dimensional (3D) sulfur–nitrogen co-doped carbon foams (S–N–CF) with hierarchical pore structures, using a convenient, economical, and scalable method. The experimental results have demonstrated that the obtained 3D S–N–CF exhibited better catalytic activity, longer-term stability and higher methanol tolerance than a commercial Pt/C catalyst. Such excellent performances may be attributed to the synergistic effect, which includes high catalytic sites for ORR provided by high S–N heteroatom loading, excellent reactant transport caused by hierarchical pore structures and high electron transfer rate provided by 3D continuous networks. Our results not only develop a new type of catalysts with excellent electrocatalytic performance by a commercially valid route, but also provide useful information for further clarification of the relationship between the microstructures of metal-free carbon materials and catalyst properties for ORR. More importantly, the idea to design hierarchical pore structures could be applied to other catalytic materials and serve as a general strategy for improving the activity of various ORR catalysts