Graphitic carbon nitride (GCN) nanosheets have the potential to serve as effective fllers for epoxy (EP) matrices, enhancing the barrier properties against the penetration of corrosive ions. This study investigates the impact of various GCNs including bulk GCN obtained through thermal treatment of urea, large-sized nanosheets (LG) synthesized via ultrasound treatment, medium-sized nanosheets (MG) fabricated by NH4OH and ultrasound treatments, and GCN quantum dots (QDs) formed through acid treatment followed by NH4OH and ultrasound treatments on A36 steel substrates. Among these, EP modifed with QD demonstrates proper anticorrosion performance in 3.5 % NaCl solution, maintaining stability from the initial application to 672 h of immersion. The corrosion current density of the QD sample decreased by two orders of magnitude compared to the bulk sample, and after 672 h of immersion, it showed excellent stability with only a slight increase. Corrosion resistance was assessed in both light (L) and dark (D) environments with the QD sample displaying the best corrosion resistance according to the extent of reduction in corrosion current density: (GCN (L) icorr = 1.42 × 10− 5 A/cm2, QD (L) icorr = 2.03 × 10− 7 A/cm2; GCN (D) icorr = 8.66 × 10− 6 A/cm2, QD (D) icorr = 2.03 × 10− 7 A/cm2). This might be attributed to an increase to the number of NH2 terminal groups and the oxygen defects due to the acid treatment of bulk g-C3N4. Moreover, the wide bandgap of the GCN in the form of QD further boosts the coating’s corrosion resistance in the presence of light.