Sulfur, trace nitrogen and iron codoped, hierarchically porous carbon foams (HPCFs) were fabricated by directly pyrolyzing sulfur-enriched conductive polymer, poly(3,4-ethylenedioxythiphene)-polystyrenesulfonic acid (PEDOT-PSS) aerogels under argon atmosphere. This simple pyrolysis treatment results in the molecular rearrangement of heteroatom sulfur, adjacent carbons and trace nitrogen/iron from oxidants to form active catalytic sites of HPCFs. At the same time, the high porosity of HPCFs provides the large surface area for the uniform distribution of active sites, and allows rapid oxygen transport and diffusion. As a result, these HPCFs exhibit the enhanced catalytic performances for oxygen reduction reaction (ORR) via a direct four-electron reduction pathway in alkaline electrolyte. Besides, they also display a higher stability and better methanol/CO tolerance than the commercial Pt/C catalyst, which makes them promising low cost, non-precious-metal ORR catalysts for practical application in fuel cells and metal-Air batteries.