Iron sulfide (FeS x ), as an anode material for lithium-ion batteries (LIBs) and sodium-ion batteries (SIBs), has attracted special attention in recent years. In this paper, an extremely facile calcination method for the synthesized of Fe7S8@C nanocomposites with different morphologies and sizes is described. The Fe7S8@C anode provides an ultrahigh charge capacity of 1042 mAh g−1 after 100 cycles at a current density of 100 mA g−1 for LIBs and 524 mAh g−1 after 150 cycles at a current density of 200 mA g−1 for SIBs. It is impressive that the material shows super-long cycle stability with a reversible capacity of 789 mAh g−1 after 1000 cycles and 370 mAh g−1 after 500 cycles at a high current density of 1000 mA g−1 and 500 mA g−1 for LIBs and SIBs, respectively. Nanosized particles, in situ generated carbon and the porous structure of the materials are beneficial for the storage of lithium/sodium ions. Importantly, the preparation of the Fe7S8@C anode provides a very simple method for the structural design of high-performance anode materials, and may be practical in various applications such as catalysis and sensors.