Sodium-glucose cotransporter-2 inhibitors (SGLT-2is) have a direct cardiac effect that is likely to be independent of its glucose lowering renal effect. Previous research has shown that SGLT2-is mitigate heart failure and prevent arrhythmic cardiac death. Our objective is to determine whether SGLT-2is reduce atrial fibrillation (AF) in comparison to other second-to third-line antidiabetic drugs in type 2 diabetes. We conducted a population-based, new-user active comparator cohort study using data from the UK Clinical Practice Research Datalink. We identified a cohort of patients initiating a new antidiabetic drug class between January 2013 and September 2020. This cohort included patients initiating their first ever non-insulin antidiabetic drug, as well as those who switched to or added-on an antidiabetic drug class not previously used in their treatment history. Individuals with a diagnosis of AF or atrial flutter at any time before cohort entry were excluded. Cox regression analysis with time-dependent covariates was used to estimate hazard ratios (HRs) and 95% confidence intervals (95% CIs) of AF comparing SGLT-2-is with other second-line to third-line antidiabetic drugs. Stratified analyses were performed according to sex, diabetes duration (<5 or≥5 years), body mass index (BMI), HbA1c, and presence of heart failure.The cohort comprised 142447 patients. SGLT-2is were associated with a statistically significant reduced hazard of AF compared to other second-line to third-line antidiabetic drugs (adjusted HR: 0.77 [95% CI: 0.68-0.88]). This reduced risk was present in both sexes but was more prominently among women (adjusted HRwomen: 0.60 [95% CI: 0.45-0.79]; HRmen: 0.85 [95% CI: 0.73-0.98]; P-value interaction: 0.012). There was no evidence for effect modification when stratifying on duration of diabetes, BMI, HbA1c, or presence of heart failure. SGLT-2is were associated with a reduced risk of AF in patients with type 2 diabetes compared to other second-line to third-line antidiabetic drugs. This reduced risk occurs in both sexes but more prominently among women.