Objective To investigate the association of serum bilirubin within normal range, especially unconjugated bilirubin (UCB), with diabetic retinopathy (DR) in patients with type 2 diabetes mellitus (T2DM).Methods In this cross-sectional, real-world study, 7617 T2DM patients were stratified into quartiles based on serum UCB levels. DR was determined by digital fundus photography and further classified into non-proliferative diabetic retinopathy (NPDR) and PDR. The associations of serum bilirubin levels and UCB quartiles with DR were investigated by logistic regression analysis.Results After controlling for age, sex, and diabetes duration, the DR prevalence was significantly decreased across the serum UCB quartiles (40.4%, 33.4%, 29.7%, 26.6% for each quartile, respectively, p < 0.001 for trend). The subjects with DR had lower serum total bilirubin (TB) and UCB, rather than conjugated bilirubin (CB), compared with those without DR (p = 0.003 for TB, p < 0.001 for UCB, and p = 0.528 for CB, respectively), while all three types of serum bilirubin in the subjects with PDR were obviously lower than those with NPDR (p = 0.006 for TB, and p < 0.001 for UCB and CB, respectively). After adjustment for confounding factors, logistic regression demonstrated negative associations of serum TB and UCB levels, rather than CB, with the presence of DR (OR: 0.844, 95%CI: 0.774–0.920, p < 0.001 for TB; OR: 0.828, 95%CI: 0.763–0.899, p < 0.001 for UCB; and OR: 0.984, 95%CI: 0.900-1.074, p = 0.713 for CB, respectively). Additionally, a fully-adjusted analysis revealed a negative correlation between UCB quartiles and DR (p < 0.001).Conclusions High-normal serum TB and UCB were closely associated with the decreased risk of DR, while all types of serum bilirubin were negatively correlated with the severity of DR in T2DM. Serum bilirubin may be used as a potential indicator to assess the risk and severity of DR in T2DM.