ImportanceStroke may be a first manifestation of an occult cancer or may be an indicator of an increased cancer risk in later life. However, data, especially for younger adults, are limited.ObjectivesTo assess the association of stroke with new cancer diagnoses after a first stroke, stratified by stroke subtype, age, and sex, and to compare this association with that in the general population.Design, Setting, and ParticipantsThis registry- and population-based study included 390 398 patients in the Netherlands aged 15 years or older without a history of cancer and with a first-ever ischemic stroke or intracerebral hemorrhage (ICH) between January 1, 1998, and January 1, 2019. Patients and outcomes were identified through linkage of the Dutch Population Register, the Dutch National Hospital Discharge Register, and National Cause of Death Register. Reference data were gathered from the Dutch Cancer Registry. Statistical analysis was performed from January 6, 2021, to January 2, 2022.ExposureFirst-ever ischemic stroke or ICH. Patients were identified by administrative codes from the International Classification of Diseases, Ninth Revision, and the International Statistical Classification of Diseases and Related Health Problems, Tenth Revision.Main Outcomes and MeasuresThe primary outcome was the cumulative incidence of first-ever cancer after index stroke, stratified by stroke subtype, age, and sex, compared with age-, sex- and calendar year–matched peers from the general population.ResultsThe study included 27 616 patients aged 15 to 49 years (median age, 44.5 years [IQR, 39.1-47.6 years]; 13 916 women [50.4%]; 22 622 [81.9%] with ischemic stroke) and 362 782 patients aged 50 years or older (median age, 75.8 years [IQR, 66.9-82.9 years]; 181 847 women [50.1%]; 307 739 [84.8%] with ischemic stroke). The cumulative incidence of new cancer at 10 years was 3.7% (95% CI, 3.4%-4.0%) among patients aged 15 to 49 years and 8.5% (95% CI, 8.4%-8.6%) among patients aged 50 years or older. The cumulative incidence of new cancer after any stroke among patients aged 15 to 49 years was higher among women than men (Gray test statistic, 22.2; P < .001), whereas among those aged 50 years or older, the cumulative incidence of new cancer after any stroke was higher among men (Gray test statistic, 943.1; P < .001). In the first year after stroke, compared with peers from the general population, patients aged 15 to 49 years were more likely to receive a diagnosis of a new cancer after ischemic stroke (standardized incidence ratio [SIR], 2.6 [95% CI, 2.2-3.1]) and ICH (SIR, 5.4 [95% CI, 3.8-7.3]). For patients aged 50 years or older, the SIR was 1.2 (95% CI, 1.2-1.2) after ischemic stroke and 1.2 (95% CI, 1.1-1.2) after ICH.Conclusions and RelevanceThis study suggests that, compared with the general population, patients aged 15 to 49 years who have had a stroke may have a 3- to 5-fold increased risk of cancer in the first year after stroke, whereas this risk is only slightly elevated for patients aged 50 years or older. Whether this finding has implications for screening remains to be investigated.