This study demonstrates a facile and effective approach to prepare nitrogen/phosphorus co-doped nonporous carbon nanofibers (N/P-NPCNFs) through the electrospinning of the polyacrylonitrile and phosphoric acid precursor solutions and subsequent thermal treatment. X-ray photoelectron spectroscopy analyses show that the contents of phosphorus and pyrrol-like nitrogen in N/P-NPCNFs can be tuned by controlling the amount of phosphoric acid. The maximum specific capacitance of 224.9 F g−1 is achieved at 0.5 A g−1 in 1 M H2SO4. Furthermore, the specific capacitance could still remain 155.5 F g−1 at 30 A g−1 with a high capacitance retention ratio of 70%. It is worth noting that no capacitance loss is observed over 8000 charge/discharge cycles, clearly demonstrating a robust long-term stability. The excellent electrochemical performance can be attributed to the synergetic effect of nitrogen and phosphorus functionalities.