With growing development of sustainable energy storage technology, rechargeable cells especially the lithium-ion batteries (LIBs) have been applied in home electric appliances, Using polyvinyl alcohol and N-rich polyacrylonitrile as carbon sources, uniform MFe 1-x Mn x PO 4 (M = Li, Na)/N-doped C nanofibers are synthesized by sol-gel pretreatment and an electrospinning method followed by calcination. The as-prepared nanofibers exhibit a 3D homogenous network with uniform distribution of MFe 1−x Mn x PO 4 nanoparticles. The lattice distorts after Mn-doping without altering the original crystalline structure, increasing conductivity and enhancing the efficiency of Li + /Na + diffusion. When applied for lithium ion batteries, the optimized LiFe 0.8 Mn 0.2 PO 4 /C nanofibers deliver a considerable initial capacity of 169.9 mAh g −1 with coulombic efficiency of 92.4%. It also displays the excellent cycling stability with reversible capacity of 160 mAh g −1 after 200 cycles at 0.1 C and high rate performances with the specific capacity of 93 mAh g −1 at 5 C. Furthermore, NaFe x Mn 1−x PO 4 /N-doped C nanofibers are also synthesized by the same method for sodium-ion batteries, which exhibit an initial capacity of 134 mAh g −1 and specific capacity of 106 mAh g −1 at 0.1 C and 90 mAh g −1 at 1 C after 200 cycles. Owing to the facile fabrication process, these nanofibers are promising cathodes for lithium/sodium ion batteries with excellent electrochemical performances.