OBJECTIVE: The aim of this study was to investigate the association between oral anticoagulant type (direct oral anticoagulants (DOACs) vs vitamin K antagonists (VKAs)) and incident dementia or mild cognitive impairment (MCI) among patients with newly diagnosed atrial fibrillation (AF). METHODS: Using linked electronic health record (EHR) data from the Clinical Practice Research Datalink in the UK, we conducted a historical cohort study among first-time oral anticoagulant users with incident non-valvular AF diagnosed from 2012 to 2018. We compared the incidence of (1) clinically coded dementia and (2) MCI between patients prescribed VKAs and DOACs using Cox proportional hazards regression models, with age as the underlying timescale, accounting for calendar time and time on treatment, sociodemographic and lifestyle factors, clinical comorbidities and medications. RESULTS: Of 39 200 first-time oral anticoagulant users (44.6% female, median age 76 years, IQR 68-83), 20 687 (53%) were prescribed a VKA and 18 513 (47%) a DOAC at baseline. Overall, 1258 patients (3.2%) had GP-recorded incident dementia, incidence rate 16.5 per 1000 person-years. DOAC treatment for AF was associated with a 16% reduction in dementia diagnosis compared with VKA treatment in the whole cohort (adjusted HR 0.84, 95% CI: 0.73 to 0.98) and with a 26% reduction in incident MCI (adjusted HR 0.74, 95% CI: 0.65 to 0.84). Findings were similar across various sensitivity analyses. CONCLUSIONS: Incident EHR-recorded dementia and MCI were less common among patients prescribed DOACs for new AF compared with those prescribed VKAs.