Background Vitamin D is a regulatory factor for immunity and skin barrier functions. It is hypothesized to be linked to atopic dermatitis (AD) which is characterized by interaction between epidermal barrier dysfunction and dysregulation of skin immune functions. Methods One hundred AD patients and one hundred and one normal controls were collected from outpatient clinic based on their clinical condition, both had measurement of 25-hydroxyvitamin D [25(OH)D]. We assessed the relationship between 25(OH)D deficiency and AD prevalence using adjusted Poisson regression model. Results Serum 25(OH)D levels were significantly lower in cases than controls (mean 35.1 versus 22.6 ng/mL, p < .001). The unadjusted prevalence ratios (PRs) (95% CI) for AD for comparing participants with intermediate and deficient vitamin D levels to those with optimal levels were 3.11 (1.91, 5.06) and 4.77 (2.99, 7.60), respectively. The association did not materially change after adjusting for potential confounders. In the fully adjusted analysis stratified by gender, PRs for AD for comparing male participants with intermediate and deficient vitamin D levels to those with optimal levels were 3.38 (1.21, 9.40) and 5.20 (1.91, 14.13), respectively, whereas in the female participants were 1.32 (0.96, 1.83) and 1.49 (1.04, 2.14), respectively (p-interaction <.001). Conclusion In this case-control study in children, we found a statistically significant dose–response association between vitamin D deficiency and AD. We also observed a statistically significant effect modification of this association by gender. Further research is recommended to study this association longitudinally, and to examine whether treating vitamin D deficiency may potentially improve AD. Key points Question: Can atopic dermatitis be associated with vitamin D deficiency? Finding: Serum 25(OH)D levels were significantly lower in cases with AD than in controls. Prevalence ratios for comparing male participants with intermediate and deficient vitamin D levels to those with optimal levels were 3.38 (1.21, 9.40) and 5.20 (1.91, 14.13), respectively, whereas in the female participants were 1.32 (0.96, 1.83) and 1.49 (1.04, 2.14), respectively (p-interaction <.001). Meaning: vitamin D deficiency is associated with AD in children, effect modification of this association by gender was also observed.