In this work, N-doped biomass derived porous carbon (NSBDC) has been prepared utilizing low-cost agricultural waste--sugarcane bagasse as the prototype, and needle-like PANI as the dopant. NSBDC possesses a special 3D interconnected framework structure, superior hierarchical pores and suitable heteroatom doping level, which benefits a large number of applications on ion storage and high-rate ion transfer. Typically, the NSBDC exhibits the high specific capacitance (298 F g−1 at 1 A g−1) and rate capability (58.7% capacitance retention at 20 A g−1), as well as the high cycle stability (5.5% loss over 5000 cycles) in three-electrode systems. A two-electrode asymmetric system has been fabricated employing NSBDC and the precursor of NSBDC (sugarcane bagasse derived carbon/PANI composite) as the negative and positive electrodes, respectively, and an energy density as high as 49.4 Wh kg−1 is verified in this asymmetric system. A NSBDC-based whole symmetric supercapacitors has also been assembled, and it can easily light a 1.5 V bulb due to its high energy density (27.7 Wh kg−1). In addition, for expanding the application areas of NSBDC, it is also applied to lithium ion battery, and a high reversible capacity of 1148 mAh g−1 at 0.1 A g−1 is confirmed. Even at 5 A g−1, NSBDC can still deliver a high reversible capacity of 357 mAh g−1 after 200 cycles, indicating its superior lithium storage capability.