We report an integrated approach by combining in-situ activation, doping and natural nanotemplating to design low-cost and highly efficient N-doped nanoporous carbons for energy storage and carbon capture applications. N-doped nanoporous carbons are prepared by impregnating sucrose, 3-amino 1,2,4-triazole and the ZnCl2 into the nanochannels of the mixed kaolin-halloysite nanotube nanoclay, followed by carbonization and clay template removal. The prepared materials exhibit micro and mesoporosity, high specific surface areas (1360–1695 m2 g−1), and nitrogen content (7.73–12.34 wt%). The optimized material offers the specific capacitance of 299 F g−1 (0.3 A g−1) and 134 F g-1 (10 A g−1) with excellent cycling stability (91% capacity retention after 4000 cycles/5 A g−1). N-doping together with the interconnected micro and mesoporous structure, offers a more ion accessible surface and further provides enhanced charge transfer, hydrophilicity, and the interaction of the electrode-electrolyte ions. The optimized material adsorbs 24.4 mmol g−1 of CO2 at 30 bar pressure and 0 °C. The synthesized materials performed better as supercapacitor and CO2 adsorbent than halloysite clay, kaolin clay, activated carbon, nanoporous carbons, and mesoporous silica. The method presented here will provide a unique platform for synthesizing a series of advanced nanostructures for electrochemical and carbon capture applications.