Near-infrared (NIR), particularly NIR-containing dual-/multi-mode afterglow, is very attractive in many fields of application, but it is still a great challenge to achieve such property of materials. Herein, we report a facile method to prepare green and NIR dual-mode afterglow of carbon dots (CDs) through in situ embedding o-CDs (being prepared from o-phenylenediamine) into cyanuric acid (CA) matrix (named o-CDs@CA). Further studies reveal that the green and NIR afterglows of o-CDs@CA originate from thermal activated delayed fluorescence (TADF) and room temperature phosphorescence (RTP) of o-CDs, respectively. In addition, the formation of covalent bonds between o-CDs and CA, and the presence of multiple fixation and rigid effects to the triplet states of o-CDs are confirmed to be critical for activating the observed dual-mode afterglow. Due to the shorter lifetime and insensitiveness to human vision of the NIR RTP of o-CDs@CA, it is completely covered by the green TADF during directly observing. The NIR RTP signal, however, can be readily captured if an optical filter (cut-off wavelength of 600 nm) being used. By utilizing these unique features, the applications of o-CDs@CA in anti-counterfeiting and information encryption have been demonstrated with great confidentiality. Finally, the as-developed method was confirmed to be applicable to many other kinds of CDs for achieving or enhancing their afterglow performances.