Red phosphorus offers a high theoretical sodium capacity and has been considered as a candidate anode for sodium-ion batteries. Similar to silicon anodes for lithium-ion batteries, the electrochemical performance of red phosphorus is plagued by the large volume variation upon sodiation. Here we perform in situ transmission electron microscopy analysis of the synthesized red-phosphorus-impregnated carbon nanofibers with the corresponding chemo-mechanical simulation, revealing that, the sodiated red phosphorus becomes softened with a liquid-like mechanical behaviour and gains superior malleability and deformability against pulverization. The encapsulation strategy of the synthesized red-phosphorus-impregnated carbon nanofibers has been proven to be an effective method to minimize the side reactions of red phosphorus in sodium-ion batteries, demonstrating stable electrochemical cycling. Our study provides a valid guide towards high-performance red-phosphorus-based anodes for sodium-ion batteries.