Hierarchical porous carbon derived from lignin (denoted as LHPC) was prepared via a facile method. In this method, KOH acts both as activating agent and template. The obtained LHPC was composed of unique 3D macroporous network with mesopores and micropores decorated on carbon walls. LHPC was further applied as the anode material of lithium ion battery and displayed a stable, high capacity of 470mAhg−1 after 400 galvanostatic charge-discharge cycles at a current density of 200mAg−1. Furthermore, LHPC displayed high cycling stability and perfect rate capability. This facile method for the preparation of LHPC offers a new route for the preparation of a series of hierarchical porous carbons for the application in supercapacitors, fuel cells, lithium ion batteries, etc.