In the fields of biomedicine, detection, and anti-counterfeiting, there is a widespread demand for cost-effective, easily synthesized, and environmentally friendly near-infrared (NIR) materials. Carbon dots (CDs), a cheap and non-toxic zero-dimensional carbon nanomaterial exhibiting exceptional photoluminescence (PL) properties and facile structural modification, have emerged as a promising candidate for the development of novel NIR materials. This study presents the synthesis of CDs capable of emitting a wide range of wavelengths from blue to NIR (456-836 nm) as their concentrations increase. The incorporation of oxygen and nitrogen co-doped atoms facilitates the optimization of non-coplanar angles, thereby promoting favorable pi-pi stacking interactions. This leads to the formation of metal-free rigid clusters through interconnecting adjacent nanoparticles in a gear-like meshing pattern through self-assembly. Consequently, intramolecular motion is constrained, vibration coupling is mitigated, non-radiative transition losses are minimized, and efficient NIR emission from CD clusters in high concentrations is ensured. Furthermore, NIR light-emitting diode (NIR LED) based on the CD clusters was successfully fabricated and employed for various applications including information encryption, anti-counterfeiting, and penetration detection in the field of NIR imaging.