Iron sulfide is considered a potential anode material for lithium-and sodium-ion batteries (LIBs/SIBs) in view of its natural abundance and high theoretical specific capacity. Nevertheless, a large volume expansion and relatively poor electronic conductivity have hindered its application. Herein, a unique composite with iron sulfide quantum dots decorated on N-doped porous carbon hierarchical frameworks (FeS@NC) is constructed via a vulcanization-carbonization strategy. The confined size of iron sulfide dots and the designed porous structure of carbon frameworks effectively alleviate the volume expansion issue upon ion insertion, while the N-doped carbon matrix efficiently enhances the electrode conductivity. Consequently, the presented FeS@NC composite exhibits excellent lithium/sodium storage performance. For LIBs, the FeS@NC electrode shows discharge capacities of 844.2 mAh/g at 0.5 A/g after 300 cycles and 578.9 mAh/g at 5 A/g in the rate test. Moreover, it delivers a high discharge capacity of 460.7 mAh/g after 350 cycles at 1 A/g for SIBs.