Several types of food can help with headaches, both for quick relief and long-term prevention. The most effective options target the common underlying triggers: dehydration, low blood sugar, inflammation, and nutrient deficiencies. What you eat (and how often you eat) can make a real difference in how frequently headaches hit and how long they last.
Water-Rich Foods for Dehydration Headaches
Dehydration is one of the most common and fixable headache triggers. Losing just 2% of your body’s water weight can bring on headaches, fatigue, and cramping. Drinking water helps, but eating water-dense foods adds fluid along with electrolytes and nutrients that plain water doesn’t provide.
The highest-water foods include cucumber (96% water), celery (95%), tomatoes (94%), zucchini (94%), watermelon (92%), strawberries (92%), and broccoli (92%). Broth is also 92% water and delivers sodium, which is one of the electrolytes your body needs to retain fluid properly. Plain yogurt (88% water) and skim milk (91%) are solid choices too, since milk contains electrolytes and protein that help your body rehydrate more effectively than water alone, especially after exercise or sweating.
Low electrolyte levels, particularly sodium, potassium, and magnesium, can contribute to headaches on their own. Electrolytes regulate nerve function and muscle contractions, so when they’re depleted, your nervous system doesn’t work as smoothly. If your headaches tend to show up after workouts, in hot weather, or when you haven’t eaten much, reaching for these foods is a practical first step.
Fatty Fish and Omega-3s
Omega-3 fatty acids from fish like salmon, mackerel, sardines, and trout are among the most well-supported dietary tools for reducing headache frequency. A study funded by the National Institutes of Health found that 16 weeks of a diet higher in omega-3s from fatty fish reduced both the frequency and severity of headaches in people with frequent migraines.
The mechanism is straightforward: your body converts omega-3 fats into compounds called oxylipins that reduce pain. Meanwhile, omega-6 fats (found heavily in vegetable oils and processed foods) get converted into oxylipins that increase pain. So the balance matters. Eating more fatty fish while cutting back on fried and heavily processed foods shifts that balance in your favor. Aim for two to three servings of fatty fish per week if headaches are a regular problem for you.
Magnesium-Rich Foods
Magnesium plays a central role in nerve signaling, and people who get frequent headaches often have lower magnesium levels. The American Migraine Foundation recognizes magnesium as a go-to preventive treatment, with supplements typically dosed at 400 to 600 mg per day.
You can boost your intake through food before turning to supplements. The best dietary sources include pumpkin seeds, almonds, cashews, spinach, black beans, avocado, and dark chocolate. Swiss chard, quinoa, and edamame are also high in magnesium. While food alone may not reach the therapeutic doses used in clinical settings, consistently eating magnesium-rich foods helps maintain the baseline your nervous system needs to function without triggering pain.
Ginger for Active Headache Relief
If you already have a headache and want food-based relief, ginger is the strongest option supported by research. In a clinical trial comparing 250 mg of ginger powder to 50 mg of sumatriptan (a standard migraine medication), both groups saw nearly identical pain reduction two hours after treatment. The ginger group scored a 4.6-point drop on a 10-point pain scale, compared to 4.7 for the medication group.
Ginger works because its active compounds block enzymes involved in producing inflammatory chemicals in the body, specifically prostaglandins and leukotrienes that amplify pain signaling. Fresh ginger tea is the easiest way to get a meaningful dose. Grate about an inch of fresh ginger root into hot water and steep for 10 minutes. Powdered ginger in capsule form works too if you prefer convenience.
Complex Carbs and Protein to Prevent Blood Sugar Drops
Skipping meals is a well-documented headache trigger. When your blood sugar drops, your brain notices quickly, and headaches are often the result. Headache specialists at the University of Utah recommend eating something every two to four hours to keep blood sugar stable, rather than going long stretches without food.
The key is pairing complex carbohydrates with protein or fat so the energy release is slow and steady. Good combinations include peanut butter on whole grain bread, nuts with dried fruit, cheese with crackers, or yogurt with berries. These keep your blood sugar from spiking and crashing the way simple sugars do. If you notice your headaches tend to hit in the late afternoon or after long gaps between meals, this eating pattern alone can make a noticeable difference.
Caffeine: Helpful in Small Doses, Harmful in Large Ones
Caffeine has a complicated relationship with headaches. In small amounts, it constricts blood vessels and enhances the effect of pain relievers, which is why it’s an ingredient in many over-the-counter headache medications. A cup of coffee or tea at the onset of a headache can genuinely help.
The problem is dependency. It takes as few as seven days of regular caffeine use to develop a physical dependence, and as little as 100 mg per day (roughly one small cup of coffee) to sustain it. Once dependent, skipping your usual caffeine triggers withdrawal headaches. The American Migraine Foundation recommends capping intake at 200 mg per day, which is about two small cups of coffee, if you get headaches regularly. If you’re currently drinking more than that, tapering down gradually over a week or two helps avoid withdrawal pain.
Nutrients That Help Over Time
Two nutrients show particular promise for reducing headache frequency when consumed consistently over months. Riboflavin (vitamin B2), found in eggs, lean meats, dairy, almonds, and mushrooms, has been studied at high doses for migraine prevention. A randomized trial published in the journal Neurology tested 400 mg of riboflavin daily for three months and found it reduced migraine frequency. You won’t reach clinical doses through food alone, but regular intake from dietary sources supports your baseline levels.
Coenzyme Q10, found in meat, fish, and nuts, helps cells produce energy. The Mayo Clinic notes that some research suggests it may lower migraine frequency or duration, though it typically takes about three months of consistent intake before any benefit appears. As with riboflavin, the amounts in food are modest compared to supplement doses, but they contribute to the overall picture.
Foods to Limit or Avoid
What you remove from your diet can matter as much as what you add. Processed foods high in omega-6 fatty acids (soybean oil, corn oil, and anything deep-fried) promote the pain-amplifying compounds that omega-3s counteract. Highly processed meats containing nitrates, aged cheeses high in tyramine, and alcohol (especially red wine) are common headache triggers for many people.
Artificial sweeteners, particularly aspartame, and MSG are frequently reported triggers as well. The tricky part is that triggers vary from person to person. Keeping a simple food diary for a few weeks, noting what you ate before headaches hit, is the most reliable way to identify your personal triggers. Focus on building meals around whole foods, lean proteins, fruits, vegetables, and healthy fats, and you’ll naturally reduce your exposure to the most common culprits.

