To tackle the issue of poor rate capability and long-term cycle stability of carbonaceous anodes for potassium-ion batteries, we herein introduce antimony nanoparticles finely encapsulated in nitrogen and phosphorus co-doped mesoporous carbon nanofibers as a novel anode material for potassium-ion batteries. It exhibits high specific capacity and ultra-long cycling stability, delivering a capacity of 266.2 mAh g−1 at 50 mA g−1 after 50 cycles and retaining a capacity of 130 mAh g−1 at 1000 mA g−1 after 1500 cycles. The excellent electrochemical performance is mainly attributed to the interconnected networks and abundant active surface sites as well as robust mechanical properties of the mesoporous carbon nanofibers. More importantly, Sb nanoparticles are encapsulated in the carbon nanofibers, resulting in high theoretical capacities. The observed superior cyclic stability and rate capability render it a promising electrode material that can be further explored for high-performance and robust potassium-ion batteries.