This work reports the obtention of Si,N,S-CQDs from sugar cane bagasse and their inhibitory action on the mild steel corrosion in 1 mol L −1 HCl solution. The CQDs were successfully obtained and characterized by X-ray photoelectron spectroscopy, Fourier-transform infrared spectroscopy, Dynamic light scattering, Raman, and UV−vis techniques, also showing endogenous self-doping. The anti-corrosive activity of CQDs was investigated by gravimetric tests, potentiodynamic polarization curves, electrochemical impedance measurements, atomic force microscopy, and scanning electron microscopy. The electrochemical results show that the CQDs present a predominant inhibitory action on the cathodic process, presenting inhibition efficiency of 82, 89, 91, and 94% for 15, 25, 50, and 100 ppm, respectively. Gravimetric tests varying temperature demonstrate that the inhibitor functions through physical adsorption and remains effective for up to 72 h, exhibiting corrosion efficiency of 80.2, 93.2, 96.3, and 97.8% at 15, 25, 50, and 100 ppm concentrations, respectively, after 72 h of immersion. Dynamic light scattering and zeta potential measurements indicate that agglomerations of CQDs play a crucial role in inhibiting corrosion. These results show an excellent alternative for using sugar cane bagasse to produce CQDs and its application as a corrosion inhibitor, valuing agricultural waste and simultaneously solving industry problems.