AIMS/HYPOTHESIS: Heart failure has been suggested to increase the risk of developing diabetes. We investigated the relation between heart failure severity, defined by loop-diuretic dosage, and the risk of developing diabetes in a nationwide cohort of patients with heart failure. METHODS: We followed all Danish patients discharged from hospitalisation for first-time heart failure in 1997-2010, without prior use of hypoglycaemic agents, until a claimed prescription for hypoglycaemic agents, death or 31 December 2010. The association of loop-diuretic dosage (furosemide equivalents) 90 days after discharge (study baseline) with risk of diabetes was estimated by multivariate Cox regression models. RESULTS: In total, 99,362 patients were included and divided into five loop-diuretic dose groups: 30,838 (31%) used no loop diuretics; 24,389 (25%) used >0-40 mg/day; 17,355 (17%) used >40-80 mg/day; 11,973 (12%) used >80-159 mg/day; and 14,807 (15%) used ≥160 mg/day. A total of 7,958 patients (8%) developed diabetes. Loop-diuretic dosages were associated with an increased risk of developing diabetes in a dose-dependent manner. Concomitant use of renin-angiotensin system inhibitors (RASis) attenuated the risk (p value for interaction <0.0001). Compared with patients using no loop diuretics (group 1), the adjusted HRs (95% CI) for developing diabetes for groups 2-5 respectively were 1.16 (1.07, 1.26), 1.35 (1.24, 1.46), 1.48 (1.35, 1.62) and 1.76 (1.61, 1.92) with RASi treatment, and 2.06 (1.83, 2.32), 2.28 (2.01, 2.59), 2.88 (2.52, 3.30) and 3.02 (2.66, 3.43) without RASi treatment. CONCLUSIONS/INTERPRETATION: In a nationwide cohort of patients with heart failure, severity of heart failure was associated with a stepwise increased risk of developing diabetes. Increased awareness of risk of diabetes associated with severe heart failure is warranted.