Transition metal oxide is a promising anode material in lithium-ion battery, however it suffers from poor cycling performance due to its large volume change during charge/discharge process. Herein, we designed and fabricated a yolk-shell Fe3O4 composite nanoparticle with individual Fe3O4 nanoparticle as the yolk and N-coped carbon as the shell by using ionic liquid as the C and N sources. The individual Fe3O4 nanoparticle was firstly covered by a sacrificial SiO2 layer, then coated with N-doped carbon by one-step carbonization with ionic liquid (3-cyanopyridine/H2SO4). After removing the SiO2 layer by NaOH etching, yolk-shell Fe3O4@void@N-doped carbon was obtained. This unique structure would not only afford adequate void to accommodate the large volume change during charge/discharge process, but also improve the structural stability and electrical conductivity. Thus, Fe3O4@void@N-doped carbon showed a high reversible capacity and cycling life of 860mAhg−1 after 500 charge/discharge cycles at a current rate of 1000mAg−1, and excellent rate capacity of 180mAhg−1 even at 7000mAg−1.