Exploring inexpensive and highly efficient electrocatalyst to decrease the overpotential of oxygen reduction reaction (ORR) is one of the key issues for the commercialization of energy conversion and storage devices. Heteroatom-doped carbon materials have attracted increasing attention as promising electrocatalysts. Herein, we prepared a highly active electrocatalyst, nitrogen, sulfur co-doped carbon nanofibers (N/S-CNF), via in situ chemical oxidative polymerization of methylene blue on the bacterial cellulose nanofibers, followed by carbonization process. It was found that the type of nitrogen/sulfur source, methylene blue and poly(methylene blue), has significantly influence on the catalytic activity of the resultant carbon nanofibers. Benefiting from the porous structure and high surface area (729 m 2 /g) which favors mass transfer and exposing of active N and S atoms, the N/S-CNF displays high catalytic activity for the ORR in alkaline media with a half-wave potential of about 0.80 V, and better stability and stronger methanol tolerance than that of 20 wt % Pt/C, indicating great potential application in the field of alkaline fuel cell.