AIMS: Inflammation is considered to play a role in the development of atrial fibrillation (AF). Hence inflammatory bowel disease (IBD) may be associated with AF. We therefore examined the incidence of AF and stroke in patients with IBD. METHODS AND RESULTS: From Danish nationwide registries 1996-2011, we identified 24 499 patients with new-onset IBD and 236 275 age- and sex-matched controls. Poisson regression analyses with continuously updated covariates were used to estimate incidence rate ratios (IRRs) of AF and stroke. Disease activity stages of flare (new disease activity), persistent activity, and remission were defined by corticosteroid prescriptions, IBD hospital admissions, and biological treatment. Inflammatory bowel disease patients had a mean age of 43.9 years, 53.9% were women, and mean follow-up was 6.8 years. Among IBD patients, 685 had AF and 549 had a stroke, corresponding to incidence rates per 1000 person-years of 4.16 vs. 2.70 for AF and 3.33 vs. 2.44 for stroke, compared with matched controls. Overall IBD-associated risk of AF corresponded to IRR 1.26 (1.16-1.36), but was driven by increased AF incidence during IBD flares [IRR 2.63 (2.26-3.06)] and persistent activity [IRR 2.06 (1.67-2.55)], whereas no increased AF risk was observed in remission periods [IRR 0.97 (0.88-1.08)]. Likewise increased stroke risk was exclusively found during active IBD [IRRs: 1.57 (1.27-1.93), 1.71 (1.32-2.21), and 1.04 (0.93-1.15) for flares, persistent activity, and remission, respectively]. CONCLUSION: Active IBD is associated with increased risk of AF and stroke. These findings may be relevant to clinical practice.