The fast spread of the coronavirus disease 2019 (COVID-19) epidemic and its high mortality were quickly noticed by the health community. B vitamins are essential micronutrients for the body with antioxidant, anti-inflammatory and immune-regulating properties. The present study can provide a comprehensive picture of the associations between B vitamins and COVID-19 incidence. This study was undertaken on 9189 adult participants of the Yazd Health Study (YaHS) and Taghzieh Mardom-e-Yazd (TAMIZ) study aged 20 to 69 years. Data on dietary intakes were obtained using a validated FFQ. Multivariable logistic regression analysis was used to evaluate the association between B vitamins and COVID-19. Our findings indicated that participants in the fourth quartile of vitamin B5 intake compared with the first quartile had a protective effect against COVID-19 (OR: 0·53, 95 % CI 0·28, 0·99, P-trend = 0·02) after adjustment for all possible confounds in model 3. In addition, participants in the third quartile of vitamin B12 intake compared with the first quartile (OR: 0·63, 95 % CI 0·40, 0·98, P-trend = 0·11) had fewer odds of COVID-19 after full adjustments for confounders. Our findings indicated no significant relationship between dietary intake of vitamin B1, B2, B3, B9 and B-complex and COVID-19. A higher intake of vitamin B5 could reduce the odds of COVID-19 by 47 %, and a moderate intake of vitamin B12 had a protective effect on COVID-19. Although our study has promising results, stronger clinical studies are needed.