Transition-metal compounds have received extensive attention from researchers due to their high reversible capacity and suitable voltage platform as potassium-ion battery anodes. However, these materials commonly feature a poor conductivity and a large volume expansion, thus leading to underdeveloped rate capability and cyclic stability. Herein, we successfully encapsulated ultrafine CoP and CoSb nanoparticles into rich N-doped carbon nanofibers (NCFs) via electrospinning, carbonization, and phosphorization (antimonization). The N-doped carbon fiber prevents the aggregation of nanoparticles, buffers the volume expansion of CoP and CoSb during charging and discharging, and improves the conductivity of the composite material. As a result, the CoP/NCF anode exhibits excellent potassium-ion storage performance, including an outstanding reversible capacity of 335 mA h g −1 , a decent capacity retention of 79.3% after 1000 cycles at 1 A g −1 and a superior rate capability of 148 mA h g −1 at 5 A g −1 , superior to most of the reported transition-metalbased potassium-ion battery anode materials.