Potassium-ion batteries (KIBs) are a promising alternative to lithium-ion batteries (LIBs) for large-scale renewable energy storage owning to the natural abundance and low cost of potassium. However, the biggest challenge for KIBs application lies in the lack of suitable electrode materials that can deliver long cycle life and high reversible capacity. In this work, we realized unprecedented long cycle life with high reversible capacity (465 mAh g-1 at 2 A g-1 after 800 cycles) as well as outstanding rate capability (342 mAh g-1 at 5 A g-1) for KIBs by embedding red P into free-standing nitrogen-doped porous hollow carbon nanofibers (red P@N-PHCNFs). This design circumvents the problems of pulverization and aggregation of P particles. The in situ transmission electron microscopy (TEM) investigation reveals the structural robustness of the composite fibers during potassiation. The formation of P-C chemical bonds as well as nitrogen doping in the carbon matrix can facilitate the sturdy contact and enhance the adsorption energy of P atoms evidenced by DFT results. In situ Raman and ex situ XRD demonstrate that the final discharge product of the red P@N-PHCNFs is K4P3.