The design of carbon material with high capacitance and stability is one of the key issues in the development of supercapacitor and lithium-ion hybrid electrochemical capacitor (Li-HEC). Herein, porous carbon material with high specific surface area, honeycomb-like structure and hierarchical pore distribution ranging from macropore to micropore, was prepared from silkworm excrement by utilizing its highly porous and three-dimensional open structure. Moreover, the porous carbon is self-doped by nitrogen, which is beneficial to increase its pseudocapacitance and wettability to the electrolyte. The symmetrical supercapacitor and Li-HEC made by as-prepared porous carbon exhibited high energy density (138.4 Wh kg−1 for supercapacitor and 242.2 Wh kg−1 for Li-HEC), excellent rate performance and stability. This study offers a facile and cost-effective strategy to prepare advanced carbon material which can be applied in energy storage devices.