• N and S co-doped coal-based hard carbon (NSPC1200) was synthesized via two-step carbonization and molten salt template method, achieving high sodium storage capacity of 314.2 mAh g−1 at 20 mA g−1.
• Two-step carbonization effectively adjusts carbon microcrystal structure and expands interlayer spacing, enhancing Na+ intercalation.
• N and S co-doping regulates electronic structure, providing more active sites for sodium storage.
• NaCl template constructs porous structure, improving electrode-electrolyte contact and ion/electron transport, leading to excellent cycling stability (224.4 mAh g−1 after 200 cycles).