For promoting the development of fuel cells and metal-air batteries, it is imperative to replace rare and expensive precious-metal catalysts with sustainable catalysts composed of earth-abundant elements. Herein, we reported the preparation of polyaniline derived N- and O-enriched high surface area hierarchical porous carbon catalysts that can be regarded as metal-free catalysts for oxygen reduction reaction (ORR). Using perchloric acid (HClO4) as oxidant and pore-forming agent, the N- and O-enriched high surface area hierarchical porous carbon catalysts were fabricated by electrochemical polymerization of aniline, followed by high temperature carbonization of the resulting polyaniline (PANI) precursors. The obtained carbon catalysts exhibited excellent catalytic activity for ORR with high ORR onset potential and high kinetic current density, and good electrochemical stability. These superior electrochemical properties of the N- and O- enriched high surface area hierarchical porous carbon catalysts were closely related to their high surface area and high content of pyridinic nitrogen and graphitic nitrogen.