BackgroundHeadache such as migraine is associated with stroke. Studies focused on primary headache disorders (PHDs) as a risk factor for stroke are limited. The purpose of this population-based cohort study was to explore whether patients with PHDs were at a high risk for developing stroke.MethodsA total of 1346 patients with PHDs were enrolled and compared with 5384 age-, gender- and co-morbidity-matched control cohorts. International Classification of Diseases, Clinical Modification codes were administered for the definition of PHDs, stroke, and stroke risk factors. Cox proportional-hazards regressions were performed for investigating hazard ratios (HR).ResultsPHDs patients exhibited a 1.49 times (95% CI :1.15–1.98, p < 0.01) higher risk for developing ischaemic stroke compared with that of control cohorts. Both migraine (HR = 1.22, 95% CI :1.13–1.97, p < 0.05) and tension-type headache (HR = 2.29, 95% CI :1.22–2.80, p < 0.01) were associated with an increased risk of ischemic stroke. Females with PHDs were at greater risk of developing ischaemic stroke (HR = 1.49, 95% CI :1.13–1.90, p < 0.01) than those without PHDs. PHDs patient aged 45 to 64 years displayed significantly higher risk to develop ischaemic stroke (HR = 1.50, 95% CI: 1.11–2.10, p < 0.05) than the matched controls. The impact of PHDs on ischaemic stroke risk became gradually apparent by different following time intervals beyond 2 years after first diagnosis.ConclusionPHDs is suggestive of an incremental risk for ischaemic stroke with gender-dependent, age-specific and time-dependent characteristics.Electronic supplementary materialThe online version of this article (doi:10.1186/s10194-016-0701-2) contains supplementary material, which is available to authorized users.