Heteroatoms in carbon nanotubes can alter their electrochemical properties. Herein, N-doped carbon nanotubes (NCNTs) with gradient doping of graphitic-N, pyridinic-N and pyrrolic-N were prepared by the pyrolysis of different ratios of low-density polyethylene (LDPE) and melamine. The lower fraction of melamine in the feedstock favored the generation of pyridinic-N and graphitic-N with lower formation energies, while the higher fraction favored the generation of pyrrolic-N with higher formation energies. Furthermore, the quantum capacitance theory demonstrated that pyridinic-N had the best energy storage effect at negative potential, and pyrrolic-N had the best energy storage effect at positive potential. The specific capacitance of the 0.6-NCNTs increased by 55 % compared to the undoped sample (1 A g−1, 1 M H2SO4), which was due to the presence of a large amount of pyrrolic-N on its surface. However, as the nitrogen content of the 0.6-NCNTs increased further, the samples suffered from a decrease in specific surface area, resulting in a decrease in specific capacitance thereafter. This paper reveals the effect of different N-doped types on the electrochemical properties of NCNTs, and provides theoretical guidance for adjusting the electrochemical properties of materials in energy storage applications.