Stroke in patients with heart failure is associated with poor outcomes. Risk stratification schemes may improve clinical decision making in this patient population. This study investigated whether female sex is a risk factor for stroke in patients with heart failure in sinus rhythm.This is a population-based cohort study of patients diagnosed with heart failure during 2000 to 2012, identified by record linkage between nationwide Danish registries. Our primary outcome was stroke, and secondary outcome was thromboembolic event. We used relative risks (RRs) after 1 and 5 years to compare males with females within each of the following age groups: 50 to 59 years, 60 to 69 years, 70 to 79 years, 80 to 89 years, and 90+ years. Analyses took into account the competing risks of death.During the study period, 84,142 patients were diagnosed with heart failure, of which 39,946 (47.5%) were females. At 5-year follow-up, female sex was associated with a lower risk of stroke compared with males (adjusted overall hazard ratio 0.91, 95% CI 0.85-0.96). The observed lower risks of stroke in females were not present in the older age groups, where the competing risk of death was substantial among males in particular. When considering a more broadly defined thromboembolic end point, a decreased risk among females persisted across nearly all age groups after 5-year follow-up (adjusted overall hazard ratio 0.93, 95% CI 0.91-0.96).We found an association between female sex and decreased stroke risk in patients with heart failure, which persisted after adjustment for concomitant cardiovascular risk factors. The association was attenuated with increasing age, possibly because of competing risks of death.