Introduction: Vitamin D insufficiency is related to a wide range of pathologies of many diseases such as migraine, and vitamin D supplementation may be sufficient for headache relief. The aim of this study was to evaluate the relationship between migraine attack parameters and dietary calcium and magnesium intake by examining the levels of vitamin D in individuals with migraine and tension-type headache, which are the most common headache types. We aimed to evaluate whether headache attack parameters were correlated with vitamin D levels in such patients. Methods: The study included 90 participants who were diagnosed with migraine without aura and tension type headache (TTH), aged 20-55 years, and a healthy control group. Individuals' serum vitamin D levels were analyzed. The correlation between migraine attack parameters (severity, frequency, duration) and serum vitamin D levels, dietary calcium and magnesium intake was assessed. The physician calculated the pain intensity score by applying a visual analog scale (VAS). Results: Serum vitamin D levels of the three groups were found to be similar (P > 0.005). Although the level of vitamin D was lower in TTH, VAS score values were significantly higher in migraine patients than in TTH patients (P < 0.001). In migraine patients, attack frequency was higher when vitamin D level was below 20 ng/dL (P = 0.015). Vitamin D level below 20 ng/dL was correlated with a higher attack frequency of migraines in the participants with migraine without aura (r = -0.381, P = 0.046). There was no significant relationship between dietary intake of calcium and magnesium and attack frequency, severity (VAS score) and duration of attack (P > 0.05). Discussion: Our results show that migraine patients in whom serum vitamin D deficiency is detected should be monitored.