Certain foods can help relieve or prevent headaches by reducing inflammation, stabilizing blood sugar, and replenishing nutrients your body needs for healthy nerve function. No single food works like popping a painkiller, but building your diet around the right ingredients can meaningfully reduce how often headaches hit and how intense they feel.
Water-Rich Foods and Plain Water
Dehydration is one of the most common and fixable headache triggers. In a clinical trial where participants added 1.5 liters of water per day, 47% reported meaningful improvement in headache-related quality of life, compared to just 25% in the control group. Their scores on a migraine-specific quality-of-life scale improved by 4.5 points. The catch: most people in the study only managed to drink about half the target amount, which suggests that even modest increases in fluid intake can help.
Beyond drinking water, you can boost hydration through foods with high water content: cucumbers, watermelon, strawberries, celery, oranges, and zucchini. These are especially useful if you find it hard to drink enough plain water throughout the day, or if your headaches tend to strike in the afternoon when mild dehydration has accumulated.
Fatty Fish and Other Omega-3 Sources
Omega-3 fatty acids, the kind found in oily fish, work against headaches by dialing down inflammation in a way that mirrors how common painkillers operate. Standard pain relievers block your body from converting certain fats into inflammatory compounds. Omega-3s do something similar naturally: they get converted into molecules called resolvins and protectins that actively resolve inflammation rather than just suppressing it. These molecules interact directly with pain-processing pathways in the trigeminal nerve, which is the nerve most involved in headache and migraine pain.
The best dietary sources are salmon, mackerel, sardines, herring, trout, and tuna. Plant-based options include walnuts, flaxseeds, chia seeds, and leafy greens, though the type of omega-3 in plants converts less efficiently in the body. Eating fatty fish two to three times per week is a reasonable target for building up these anti-inflammatory fats over time.
Magnesium-Rich Foods
Magnesium plays a central role in nerve signaling and muscle relaxation, and low levels are consistently linked to more frequent headaches. The American Migraine Foundation notes that supplemental magnesium at 400 to 600 mg per day is commonly used for migraine prevention. While supplements are one route, you can get a substantial amount from food.
The richest dietary sources include pumpkin seeds (about 150 mg per ounce), almonds, cashews, dark chocolate, spinach, black beans, and avocado. A handful of pumpkin seeds plus a cup of cooked spinach at dinner gets you roughly halfway to that 400 mg target. Whole grains like brown rice and quinoa contribute smaller but consistent amounts throughout the day. If you get frequent headaches and suspect your magnesium intake is low, increasing these foods is one of the lowest-risk changes you can make.
Ginger
Ginger has surprisingly strong evidence behind it. In a clinical trial comparing 250 mg of powdered ginger to 50 mg of sumatriptan (a prescription migraine drug), both groups experienced nearly identical reductions in pain intensity. The ginger group’s pain scores dropped by 4.6 points on a 10-point scale, while sumatriptan dropped pain by 4.7 points.
A quarter teaspoon of ground ginger is roughly 250 mg, so you don’t need much. You can stir it into hot water for a quick tea, grate fresh ginger into soup or stir-fry, or blend it into a smoothie. Keeping ground ginger in your kitchen means you have a fast option when a headache starts building. It won’t work for everyone, but the evidence suggests it’s worth trying before reaching for medication.
Steady Blood Sugar: Complex Carbs and Protein
Skipping meals, particularly breakfast, increases low-grade inflammation and disrupts how your body manages glucose and fat metabolism. While true hypoglycemia isn’t a consistent headache trigger on its own, the blood sugar swings from erratic eating patterns are strongly associated with more frequent attacks.
One randomized controlled trial found that a low-glycemic-index diet improved migraine frequency at a rate comparable to standard preventive medication. Low-glycemic foods release sugar slowly: oatmeal, sweet potatoes, lentils, chickpeas, most vegetables, and whole-grain bread. Pairing carbohydrates with protein, fat, or fiber slows digestion further. A breakfast of eggs with whole-grain toast, or oatmeal topped with nuts and berries, keeps blood sugar far more stable than cereal or a pastry alone. If your current breakfast is just coffee, that’s a place to start.
Riboflavin and CoQ10 in Food
Two nutrients with dedicated research behind them for headache prevention are riboflavin (vitamin B2) and coenzyme Q10. A landmark trial published in Neurology found that 400 mg of riboflavin per day significantly reduced migraine frequency over three months. That’s a high dose, difficult to reach through food alone, but regularly eating riboflavin-rich foods still contributes to your overall levels. Good sources include eggs, lean beef, mushrooms, almonds, yogurt, and fortified cereals.
For CoQ10, a review of multiple studies found that supplementation significantly reduced the frequency of migraine attacks, with effective doses ranging from 30 to 800 mg per day over at least six weeks. Foods that contain CoQ10 include organ meats (especially heart), sardines, mackerel, peanuts, and broccoli. You won’t hit supplement-level doses through diet, but these foods stack with the other headache-fighting nutrients already on this list, and many of them (sardines, broccoli, nuts) pull double duty by also providing magnesium or omega-3s.
Caffeine: A Double-Edged Tool
Caffeine can both treat and cause headaches depending on how you use it. At doses of 100 mg or more (roughly one cup of brewed coffee), caffeine enhances the effectiveness of pain relievers for both tension headaches and migraines. It works by constricting blood vessels and improving how quickly your body absorbs other pain-fighting compounds.
The problem starts with regular use above 200 mg per day, which is about two standard cups of coffee. At that level, your body adapts, and skipping your usual dose can trigger a withdrawal headache within 24 hours. If you currently drink a lot of caffeine and get frequent headaches, gradually reducing your intake to under 200 mg daily may help break the cycle. Used occasionally and deliberately, a cup of coffee or strong tea at headache onset is a legitimate tool. Used heavily every day, it becomes part of the problem.
Foods That Can Trigger Headaches
Knowing what to eat matters, but so does knowing what to avoid. Several naturally occurring chemicals in food are well-documented headache triggers:
- Tyramine builds up in aged and fermented foods: aged cheeses, soy sauce, sauerkraut, and overripe fruit. Beef and chicken liver are also high in tyramine.
- Nitrates and nitrites are preservatives found in processed meats like bacon, hot dogs, salami, and smoked or cured fish.
- Sulfites appear in wine, dried fruits like raisins, and some condiments.
- MSG (monosodium glutamate) shows up in many packaged snacks, fast food, and some Asian sauces.
- Aspartame, the artificial sweetener in diet sodas and sugar-free gum, is a trigger for some people.
Not everyone reacts to all of these. If you suspect food triggers are involved in your headaches, an elimination approach works well: remove the most common culprits for two to three weeks, then reintroduce them one at a time and track what happens. Bananas and dried fruits are easy to overlook since they seem healthy, but both contain tyramine or sulfites that can be problematic for sensitive individuals.
Putting It Together
The most effective dietary approach to headaches isn’t about finding one magic food. It’s about layering several of these strategies: staying well-hydrated, eating regular meals built around whole foods, getting enough magnesium and omega-3s, and minimizing your personal trigger foods. A realistic day might look like oatmeal with almonds and berries for breakfast, a salad with salmon and avocado for lunch, ginger tea in the afternoon, and a dinner with sweet potatoes, spinach, and grilled fish. None of that requires specialty ingredients or dramatic changes, and each component addresses a different mechanism behind headache pain.

