Rheumatoid arthritis (RA), a chronic, systemic inflammatory disorder, primarily affects joints. Several studies have indicated that early inflammation, cardiovascular disease, and depression in patients were associated with a considerably increased risk of dementia. Nonsteroidal anti-inflammatory drugs (NSAIDs) are commonly used for treating RA. NSAIDs facilitate alleviating RA-associated chronic pain, inflammation, and swelling. Therefore, we conducted this nationwide study for evaluating the association between the dementia risk and NSAID treatment in patients with RA.The RA cohort comprised patients aged 20 years and older who were newly diagnosed with RA between 2000 and 2011, with data obtained from the Registry of Catastrophic Illnesses Patient Database (RCIPD). Patients without RA were frequency matched with the RA cohort at a 1:4 ratio according to age, sex, and year of RA diagnosis. The relative risks of dementia were estimated using Cox proportional hazard models.The risk of dementia in the RA cohort was not significantly higher than that in the non-RA cohort (adjusted HR [hazard ratio] = 0.95, 95% confidence interval [CI] = 0.87-1.02). Regarding the duration of NSAID treatment, the risk of dementia was significantly lower when the RA cohort used NSAIDs for >2191 days (HR = 0.56, 95% CI = 0.45-0.68).A longer duration of NSAID treatment possibly reduces the risk of dementia. Additional studies are warranted for verifying the association of dementia risk with NSAID treatment in patients with RA.