OBJECTIVE: To determine the long-term association of hemoglobin levels and anemia with risk of dementia, and explore underlying substrates on brain MRI in the general population. METHODS: Serum hemoglobin was measured in 12,305 participants without dementia of the population-based Rotterdam Study (mean age 64.6 years, 57.7% women). We determined risk of dementia and Alzheimer disease (AD) (until 2016) in relation to hemoglobin and anemia. Among 5,267 participants without dementia with brain MRI, we assessed hemoglobin in relation to vascular brain disease, structural connectivity, and global cerebral perfusion. RESULTS: During a mean follow-up of 12.1 years, 1,520 individuals developed dementia, 1,194 of whom had AD. We observed a U-shaped association between hemoglobin levels and dementia (p = 0.005), such that both low and high hemoglobin levels were associated with increased dementia risk (hazard ratio [95% confidence interval (CI)], lowest vs middle quintile 1.29 [1.09-1.52]; highest vs middle quintile 1.20 [1.00-1.44]). Overall prevalence of anemia was 6.1%, and anemia was associated with a 34% increased risk of dementia (95% CI 11%-62%) and 41% (15%-74%) for AD. Among individuals without dementia with brain MRI, similar U-shaped associations were seen of hemoglobin with white matter hyperintensity volume (p = 0.03), and structural connectivity (for mean diffusivity, p < 0.0001), but not with presence of cortical and lacunar infarcts. Cerebral microbleeds were more common with anemia. Hemoglobin levels inversely correlated to cerebral perfusion (p < 0.0001). CONCLUSION: Low and high levels of hemoglobin are associated with an increased risk of dementia, including AD, which may relate to differences in white matter integrity and cerebral perfusion.