This study addresses the imperative need for high-performance and sustainable energy storage and conversion technologies by leveraging the unique properties of nitrogen-doped porous carbon (N@WnAC) derived from the waste walnut shells (WnS). In the realm of supercapacitors, the N@WnAC demonstrates remarkable performance in a three-electrode system, showcasing a high specific capacitance value of 276.7 Fg−1 at 1 Ag−1, outstanding stability (96.6 %, 5000 charge–discharge cycles) and favourable rate capability (68.8 % at 10 Ag−1). Moreover, a quasi-solid-state symmetrical supercapacitor (N@WnAC//N@WnAC) is fabricated with PVA/H2SO4 gel electrolyte, underscores outstanding performance by delivering high capacitance (126.2 Fg−1 at 0.5 Ag−1), promising rate capability (71.8 % at 5 Ag−1), favourable long-term stability (93.3 %, 5000 charge–discharge cycles), and faster charge–discharge kinetics compared to conventional counterparts. At the same time, N@WnAC//N@WnAC delivers a high energy density (42.27 Whkg−1 at 0.5 Ag−1) that was retained up to 23.96 Whkg−1 even at 5 Ag−1. Simultaneously, the study explores the potential of N@WnAC as a counter-electrode (CE) in dye-sensitized solar cells (DSSC). The obtained results underscore that unique nitrogen doping enhances the electrocatalytic activity, leading to improved electron transfer kinetics and overall cell performance. Moreover, the N@WnAC CE-based DSSC delivers a promising overall solar-to-electrical conversion efficiency of 5.84 %.