A new strategy has been devised for sustainable biomass-based energy storage. In this work, three-dimensional N,S-co-doped hierarchical porous carbons (N,S-LPHC) derived from lignin have been designed using thiourea and KOH as active agents. The impact of the thiourea to lignin feed ratio on the porous structure and electrochemical performance is investigated. The Optimized N,S-LPHC1:1 shows a large specific surface area and mesoporous rate of 1639.8 m2 g−1 and 37.9 %. Density functional theory (DFT) calculations have illustrated that the incorporation of nitrogen and sulfur within the carbon skeleton can effectively regulate its electronic distribution, thereby enhancing the charge transfer efficiency during the electrode reactions. The specific capacitance of N,S-LPHC1:1 reaches to 185.5 F g−1 at 0.5 A g−1. And the symmetrical supercapacitor device based on N,S-LPHC1:1 exhibits excellent energy density (5.73 Wh kg−1 at 125 W kg−1) and impressive cycle stability (retaining a capacitance of 95.6 % after 10,000 charge-discharge cycles).