What to Eat for a Headache (and What to Avoid)

Certain foods can help relieve a headache or reduce how often you get them, mostly by addressing the underlying triggers: dehydration, blood sugar crashes, inflammation, and nutrient gaps. What you eat matters just as much as what you avoid, and small dietary shifts can make a real difference in headache frequency over time.

Hydrating Foods for Dehydration Headaches

Even mild dehydration, just a pint or two below normal fluid levels, can trigger a headache along with dizziness and mental fog. Drinking water is the obvious fix, but water-rich foods help you stay ahead of the problem, especially if you tend to forget to drink throughout the day.

Cucumbers are more than 96% water, making them one of the most hydrating foods you can eat. Celery comes in at about 95% water and also supplies electrolytes like magnesium and potassium, which help your body actually retain that fluid. Watermelon sits around 92% water and provides natural sugars that can help if your headache involves low energy. Other strong options include tomatoes (95% water), zucchini (95%), bell peppers (92%), and strawberries (above 90%). Tossing a few of these into a meal or snack when a headache starts is a simple first step.

Omega-3 Rich Fish to Reduce Headache Frequency

One of the strongest dietary links to headache prevention involves omega-3 fatty acids. A study of 182 people who experienced migraines 5 to 20 days per month found that 16 weeks on a diet higher in omega-3s from fatty fish reduced both headache frequency and severity compared to a typical American diet. Participants had fewer total hours of headache and fewer days with headache each month.

The benefit comes from how your body processes these fats. Omega-3s produce compounds that dampen pain signaling, while omega-6 fatty acids (abundant in vegetable oils, fried foods, and processed snacks) produce compounds that increase it. The study found that people who increased omega-3s while also cutting back on omega-6s got the best results. Practically, this means eating fatty fish like salmon, mackerel, sardines, or trout several times a week and cooking with olive oil instead of corn or soybean oil.

Magnesium-Rich Foods

Magnesium plays a direct role in calming overactive nerve signaling in the brain. It inhibits the kind of neuronal overexcitation involved in headaches, reduces the formation of inflammatory substances, and supports healthy serotonin transmission. Many people with frequent headaches have lower magnesium levels than average.

The best dietary sources include dark leafy greens (spinach, Swiss chard, kale), pumpkin seeds, almonds, cashews, black beans, and whole grains like quinoa and brown rice. Avocados and dark chocolate are also good sources. Building these into your regular meals, rather than relying on a single high-magnesium food now and then, gives your body the steady supply it needs for nerve function.

Complex Carbs to Prevent Blood Sugar Drops

Skipping meals or eating sugary, refined foods can cause your blood sugar to spike and then crash. That crash is called reactive hypoglycemia, and headaches are one of its hallmark symptoms. Simple carbohydrates like white bread, pastries, and sugary drinks are broken down into glucose so quickly that your blood sugar plummets shortly after eating them.

Complex carbohydrates avoid this problem. They’re higher in fiber and protein, which creates a gradual rise and gradual drop in blood sugar instead of a spike. Good choices include:

  • Whole grains: brown rice, wild rice, quinoa, oatmeal, barley, sprouted grain bread
  • Legumes: black beans, chickpeas, lentils, split peas
  • Seeds: chia seeds, ground flax seeds

Pairing these with a protein source (eggs, nuts, fish) slows digestion further and keeps your blood sugar stable for hours. If you’re prone to headaches in the late afternoon, this kind of steady-fuel lunch can prevent them.

Ginger for Active Headache Relief

Ginger is one of the few foods with evidence for treating a headache that’s already started. A clinical trial compared ginger powder to sumatriptan, a commonly prescribed migraine medication, and found nearly identical pain reduction at two hours. The ginger group saw pain scores drop by 4.6 points on a 10-point scale, while the medication group dropped 4.7 points.

You can grate fresh ginger into hot water for a strong tea, add it to a smoothie, or keep ground ginger on hand. The amounts used in studies were relatively small, roughly a quarter teaspoon of powder, so you don’t need to consume large quantities.

Caffeine: A Double-Edged Sword

A cup of coffee or tea can genuinely ease a headache. Research shows caffeine is about as effective as acetaminophen for tension-type headaches, and it’s an ingredient in several over-the-counter pain relievers for good reason. It constricts dilated blood vessels around the brain and enhances the absorption of other pain-relieving compounds.

The problem is dependence. Caffeine dependency can develop after as little as seven days of daily use, and it takes a surprisingly small amount to sustain it: roughly 100 mg per day, or one standard cup of coffee. Once dependent, skipping your usual dose triggers a withdrawal headache, which feels identical to the headaches you were trying to treat. If you have frequent headaches, limiting caffeine to no more than two days per week prevents this cycle from taking hold.

Foods That Commonly Trigger Headaches

Knowing what to avoid is just as important as knowing what to eat. Several naturally occurring compounds in food are well-documented headache triggers, particularly for people prone to migraines.

Tyramine builds up in aged and fermented foods. The worst offenders are aged cheeses (the older the cheese, the higher the tyramine), cured and processed meats like salami, pepperoni, hot dogs, bacon, and beef jerky, and fermented soy products like miso, tempeh, and soy sauce. Overripe bananas and dried fruits like raisins also contain significant tyramine. Nitrates and nitrites, used as preservatives in deli meats and sausages, are another common trigger. Yogurt, sour cream, and buttermilk can also be problematic for sensitive individuals.

High sodium intake has a measurable relationship with headaches as well. A study published in the British Journal of Nutrition found that people with the highest sodium levels had significantly longer headache duration and higher headache impact scores compared to those with the lowest levels. Cutting back on processed and packaged foods, which account for most dietary sodium, is one of the simplest changes you can make.

Putting It Together

The overall pattern is clear: a diet built around whole, unprocessed foods tends to reduce headache frequency, while the standard Western diet, heavy in refined carbs, vegetable oils, processed meats, and sodium, tends to increase it. You don’t need a specialized meal plan. Eating more fatty fish, leafy greens, whole grains, nuts, seeds, and water-rich vegetables while cutting back on processed and aged foods covers most of the dietary factors linked to headaches. Keeping meals consistent (not skipping them), staying hydrated, and being careful with caffeine handles the rest.