Simultaneously improving ion transport and electronic conductivity in capacitive deionization (CDI) carbon-based electrodes without compositing remains challenging. Herein, we report a straightforward strategy to convert biogas slurry (BS) into graphitized porous carbon (PE-x, where x denotes the carbonization temperature). This involves a hydrothermal pretreatment of BS with potassium ferrate (K2FeO4) followed by a single-step pyrolysis. K2FeO4 functions as both activator and graphitization catalyst, enabling concurrent pore formation and ordering of the carbon network. This single step route is efficient, time saving, and environmentally friendly compared with conventional two step processes. The optimized sample, PE-800, has a specific surface area of 312.74 m2 g−1, is rich in mesopores, and shows a high degree of graphitization. Electrochemically, PE-800 delivers a specific capacitance of 106.57 F g−1 at 5 mV s−1. In CDI tests at 1.2 V, it achieves a desalination capacity of 99.09 mg g−1 and a rate of 3.30 mg g−1 min−1, while retaining approximately 90 % capacitance after 50 cycles. This strategy provides a cost-effective pathway to upcycle biomass waste into high value carbon electrodes for CDI.