The development of active, durable, and low-cost catalysts to replace noble metal-based materials is highly desirable to promote the sluggish oxygen reduction reaction in fuel cells. Herein, nitrogen and fluorine-codoped three-dimensional carbon nanowire aerogels, composed of interconnected carbon nanowires, were synthesized for the first time by a hydrothermal carbonization process. Owing to their porous nanostructures and heteroatom-doping, the as-prepared carbon nanowire aerogels, with optimized composition, present excellent electrocatalytic activity that is comparable to commercial Pt/C. Remarkably, the aerogels also exhibit superior stability and methanol tolerance. This synthesis procedure paves a new way to design novel heteroatom-doped catalysts.