Carbon‐coated magnesium ferrite (MgFe2O4@C) nanofibers were synthesized by electrospinning technology and a subsequent carbonization process using polydopamine as carbon precursor. SEM and TEM observations revealed that N‐doped carbon layers with different thicknesses were coated uniformly on the surface of the MgFe2O4 nanofibers. If used as anode materials for lithium–ion batteries (LIBs), MgFe2O4@C nanofibers with a carbon thickness of 7 nm exhibited an excellent cycling performance and rate capability compared with pristine MgFe2O4 and MgFe2O4@C nanofibers with carbon thicknesses of 4 and 15 nm, respectively. These nanofibers delivered high initial discharge and charge capacities of 1383 and 1044 mAh g−1, respectively, with a Coulombic efficiency of 75.5 %. A reversible capacity of 926 mAh g−1 could be obtained after 200 cycles at 0.1 Ag−1. Even at a high rate of 1 A g−1 after 500 cycles, they still maintained a stable capacity of 610 mAh g−1 with a capacity retention of 81.9 %. Therefore, the MgFe2O4@C nanofibers are a potential anode candidate for LIBs.