Herein, we present a detailed study by N2 sorption and Small Angle X-ray Scattering (SAXS) of the carbonization and KOH activation of lignin for its application as active material for electrochemical energy storage. It has been observed that i) the carbonization of lignin above 700 °C leads to a hard carbon with a large amount of bulk (buried) fine structure microporosity and a good performance as Na-ion negative electrode, ii) when KOH activation is done after complete carbonization it is mainly increasing the accessibility of the initial bulk microporosity, leading to a carbon with good performance as symmetric supercapacitor in aqueous electrolyte and iii) when carbonization and KOH activation are done simultaneously, a distinct pore structure is generated with a large amount of mesopores, suitable for symmetric supercapacitor in organic electrolyte. By combining SAXS, which is sensitive to bulk as well as surface porosity, and N2 sorption which probes surface porosity, it has been possible to follow the intricate mechanism of microporosity development. Finally, it is believed that these results can be extrapolated to various biomass based precursors.