Background and objectives: Underlying occult cancer could potentially explain some of the observed increased long-term mortality among brain abscess patients. Methods: Nationwide, population-based healthcare registries were used to examine long-term risks of cancer in brain abscess patients from 1982 through 2016 compared with a population comparison cohort individually matched (10:1) on age, sex, and residence. Cumulative incidences and adjusted cause-specific hazard rate ratios (HRR) with 95% confidence intervals (CIs) for cancer were computed. Potential confounding by family-related factors was explored by comparing cumulative incidences of cancer among siblings of both groups. Results: Among 1,384 brain abscess patients (37% female, median age 50 years, IQR 33-63), cancer was observed in 218 (16%) compared with 1,657/13,838 (12%) in the comparison cohort yielding an adj. HRR of 2.09 (95% CI 1.79-2.45). Median time to diagnosis of cancer was 1.8 years (IQR 0.02-9.1) in brain abscess patients and 8.6 years (IQR 3.9-15.9) in comparison cohort. Among brain abscess patients, central nervous system and eye cancer was diagnosed in 59 (4.3%), of which 47/59 (80%) occurred within 90 days of the admission date, metastasizing cancer in 54 (3.9%), respiratory tract cancer in 48 (3.5%), and gastro-intestinal cancer in 36 (2.6%). Results remained consistent in almost all subgroups and in sensitivity analyses. Accounting for competing risk of death, the 1-, 5-, 10-, and 35-year cumulative incidence of cancer was 7% (95% CI 6-8), 11% (95% CI 9-12), 13% (95% CI 11-15), and 24% (95% CI 20-27) in brain abscess patients compared with 0.7% (95% CI 0.6-0.9), 4% (95% CI 4-5), 8% (95% CI 8-9), and 25% (95% CI 23-27) in the comparison cohort. The cumulative incidences of cancer among siblings of brain abscess patients was 10% and 12% among siblings of the comparison cohort. Discussion: Brain abscess was associated with substantially increased risk of cancer during the first ten years after diagnosis.