To determine the correlation between the severity of chronic kidney disease (CKD) and treatment of diabetic macular edema (DME). The retrospective 2-year cohort study included eyes with DME confirmed using spectral-domain optical coherence tomography in Taipei Veterans General Hospital, Taiwan, between 2010 and 2020. All the eyes were treated with an intravitreal injection of anti-vascular endothelial growth factor (anti-VEGF) during regular follow-up around 2 years. They were categorized into 3 different groups: an estimated glomerular filtration rate ≥ 60 (mL/min per 1.73 m2) (group A), < 60 (group B), and patients undergoing hemodialysis (group C). The main outcome measures were (1) visual improvement, (2) structural improvement, and (3) the injection frequency of anti-VEGF in the different groups. In this study, 167 eyes from 120 patients were enrolled. Compared with groups B and C, the eyes in group A experienced the only significant visual improvement at month 3, month 6, and month 12 (P = 0.0001, 0.0002, 0.0013, respectively). The presence of subretinal fluid and intraretinal cysts was significantly decreased in groups A and B. In the treatment frequency analysis, the number of injections was the highest in group A and lowest in group C during the study period (P = 0.04). The severity of CKD had an impact on the DME treatment. The less severe CKD was, the greater the visual improvement that could be achieved. In addition, relatively poor renal function required a lower anti-VEGF injection frequency. The active prevention of the progression of CKD may play a key role in DME treatment.