This population-based study investigated the risk of having had prior herpes zoster within five years preceding a diagnosis of head and neck cancer. We conducted a case-control study that included 9,191 patients with a diagnosis of head and neck cancer in Taiwan’s Longitudinal Health Insurance Database 2010 and 36,764 matched controls. We assessed the odds of patients with head and neck cancer having had a diagnosis of herpes zoster during the five years preceding head and neck cancer using multiple logistic regression analysis. The prevalence of prior herpes zoster among the total sample was 4.6%, 7.9% and 3.8% among patients with and without head and neck cancer, respectively (p < 0.001). The odds ratio of herpes zoster among the head and neck cancer- versus control group was 2.198 (95% CI = 2.001 ~ 2.415) after adjusting for sociodemographic characteristics and hypertension, diabetes, hyperlipidemia, tobacco use disorder, HPV infection, and alcohol dependence syndrome. Statistically significant excess odds were observed for all specific subtypes of head and neck cancer except for sinonasal cancer. Herpes zoster infection within the 5 years preceding a diagnosis of head and neck cancer may be a harbinger of developing head and neck cancer.© 2024. The Author(s).