Objective To investigate the association of non-steroidal anti-inflammatory drugs (NSAIDs) and the risk of atrial fibrillation in a prospective community-based follow-up study of elderly individuals with uniform case assessment and data on potential confounders. Design Data came from the population-based follow-up study, the Rotterdam Study. Participants The study comprised 8423 participants without atrial fibrillation at baseline. Main outcome measures Atrial fibrillation was ascertained from ECG assessments as well as medical records. Use of NSAIDs was obtained from automated prescription records by linkage with participating pharmacies. We used Cox proportional hazards models to study the association between NSAID drug use and atrial fibrillation. Use of NSAIDs was included in the model as a time-varying variable. Results At baseline, the mean age of the study population was 68.5years (SD: 8.7) and 58% were women. During a mean follow-up of 12.9years, 857 participants developed atrial fibrillation. Current use of NSAIDs was associated with increased risk compared with never-use (HR 1.76, 95% CI 1.07 to 2.88). Also, recent use (within 30days after discontinuation of NSAIDs) was associated with an increased risk of atrial fibrillation compared with never-use (HR 1.84, 95% CI 1.34 to 2.51) adjusted for age, sex and several potential confounders. Conclusions In this study, use of NSAIDs was associated with an increased risk of atrial fibrillation. Further studies are needed to investigate the underlying mechanisms behind this association.