N-doping content and configurations have a significant effect on the electrochemical performance of carbon anodes. Herein, we proposed a simple method to synthesize highly N self-doped chitosan-derived carbon with controllable N-doping types by introducing 2ZnCO3 ·3Zn(OH)2 into the precursor. The as-synthesized NC-CS/2ZnCO3·3Zn(OH)2 electrode exhibited more than twice the reversible capacity (518 mAh g− 1 after 100 cycles at 200 mA g− 1) compared to the NC-CS electrode, superior rate performance and outstanding cycling stability. The remarkable improvement should be mainly attributed to the increase of N-doping content (particularly the pyrrolic-N content), which provided more active sites and favored Li+ diffusion kinetics. This study develops a cost-effective and facile synthesis route to fabricate high-performance N self-doped carbon with tunable doping sites for rechargeable battery applications.