We fabricated sulfur and nitrogen codoped cyanoethyl cellulose-derived carbons (SNCCs) with state-of-the-art electrochemical performance for potassium ion battery (PIB) and potassium ion capacitor (PIC) anodes. At 0.2, 0.5, 1, 2, 5, and 10 A g −1 , the SNCC shows reversible capacities of 369, 328, 249, 208, 150, and 121 mA h g −1 , respectively. Due to a high packing density of 1.01 g cm −3 , the volumetric capacities are also uniquely favorable, being 373, 331, 251, 210, 151, and 122 mA h cm −3 at these currents, respectively. SNCC also shows promising initial Coulombic efficiency of 69.0% and extended cycling stability with 99.8% capacity retention after 1000 cycles. As proof of principle, an SNCC-based PIC is fabricated and tested, achieving 94.3 Wh kg −1 at 237.5 W kg −1 and sustaining over 6000 cycles at 30 A g −1 with 84.5% retention. The internal structure of S and N codoped SNCC is based on highly dilated and defective graphene sheets arranged into nanometer-scale walls. Using a baseline S-free carbon for comparison (termed NCC), the role of S doping and the resultant dilated structure was elucidated. According to galvanostatic intermittent titration technique and electrochemical impedance spectroscopy analyses, as well as COMSOL simulations, this structure promotes rapid solid-state diffusion of potassium ions and a solid electrolyte interphase that is stable during cycling. X-ray diffraction was used to probe the ion storage mechanisms in SNCC, establishing the role of reversible potassium intercalation and the presence of KC 36 , KC 24, and KC 8 phases at low voltages.