What Food Is Good for Headaches? What to Eat and Avoid

Several types of food can help prevent or reduce headaches, mostly by addressing the underlying triggers: inflammation, blood sugar drops, dehydration, and nutrient deficiencies. The most effective dietary approach combines anti-inflammatory foods like fatty fish, blood-sugar-stabilizing meals built around complex carbohydrates, and key nutrients like riboflavin and magnesium. Here’s what to put on your plate and why it helps.

Fatty Fish and Omega-3s

Fatty fish like salmon, mackerel, sardines, and trout are some of the most effective foods for reducing headache frequency. Your body converts the omega-3 fats in these fish into compounds that actively dampen pain signaling. 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: omega-3s produce pain-reducing compounds, while omega-6 fats (abundant in vegetable oils, processed snacks, and fried foods) produce compounds that increase pain. Most modern diets are heavy on omega-6s and light on omega-3s, so shifting the balance matters. If you don’t eat fish, walnuts, flaxseeds, and chia seeds provide a plant-based form of omega-3, though the conversion to the active pain-reducing compounds is less efficient.

Complex Carbs and Blood Sugar Stability

Low blood sugar is one of the most common and overlooked headache triggers. When your blood sugar drops, whether from skipping a meal or eating something sugary that causes a spike and crash, it can set off a headache or even a full migraine attack. The National Headache Foundation points to a “neuroenergetic” hypothesis suggesting that a blood sugar drop after eating can directly trigger migraine episodes.

The fix is choosing carbohydrates that digest slowly and keep your blood sugar steady. Whole grains, lentils, beans, and berries are all good options. Pairing them with protein and healthy fat slows digestion even further. Think oatmeal with nuts and yogurt, or a lentil soup with olive oil. A sandwich on whole-grain bread with chicken and avocado checks every box.

Timing matters too. Eating a balanced meal every three to four hours prevents the kind of blood sugar dips that leave you reaching for painkillers by mid-afternoon. If you notice headaches on days you skip breakfast or eat lunch late, this is likely the connection.

Riboflavin-Rich Foods

Riboflavin (vitamin B2) is one of the best-studied nutrients for migraine prevention. Clinical trials have used 400 mg daily for adults over three months to reduce migraine frequency. You can’t realistically hit that therapeutic dose through food alone, but regularly eating riboflavin-rich foods still contributes to your baseline levels and supports the same protective pathways.

Good sources include eggs, dairy milk, yogurt, almonds, salmon, spinach, lean beef, chicken breast, and fortified cereals. Beef liver is exceptionally high in riboflavin, though it’s not to everyone’s taste. Even if you ultimately need a supplement for full migraine prevention, building these foods into your diet gives you a head start.

Ginger

Fresh ginger is one of the few foods that can help during a headache, not just prevent one. A clinical trial found that ginger reduced migraine pain to mild or no pain within two hours, performing on par with sumatriptan, a common prescription migraine medication. Ginger also caused significantly fewer side effects than the drug.

You can grate fresh ginger into hot water for a simple tea, blend it into a smoothie, or add it to stir-fries and soups. Powdered ginger works too. There’s no precise dose established for food-based use, but the studies used roughly a quarter teaspoon of ginger powder, so you don’t need much.

Water and Hydrating Foods

Dehydration is a well-known headache trigger, and drinking more water does seem to improve how people experience their headaches, even if the science is nuanced. A randomized trial of 102 headache patients found that those who increased their daily water intake by 1.5 liters reported a significant improvement in migraine-related quality of life compared to the control group. Nearly half the water group (47%) rated their improvement as substantial, compared to just 25% in the control group.

Interestingly, the study didn’t find a statistically significant reduction in the number of headache days per month. That suggests water may not prevent headaches outright but can make them less disruptive when they do occur. Either way, staying well hydrated is a low-effort strategy worth adopting. Water-rich foods like cucumbers, watermelon, oranges, and celery contribute to your fluid intake alongside what you drink.

Caffeine: Helpful in Small Doses

Caffeine is a double-edged sword for headaches. In small amounts, it narrows blood vessels around the brain and reduces pain. It also boosts the absorption and effectiveness of common pain relievers like ibuprofen and acetaminophen, which is why caffeine appears in many over-the-counter headache medications. A cup of coffee or tea at the onset of a headache can genuinely help.

The problem comes with regular use. When you drink caffeine daily, your body adapts. Stop or cut back, and the blood vessels around your brain widen, increasing blood flow and pressure on surrounding nerves. This rebound effect is a caffeine withdrawal headache, and it’s remarkably common. If you’re prone to headaches, keeping caffeine intake moderate and consistent, rather than alternating between heavy use and none, prevents this cycle.

Foods to Avoid

Some foods that seem healthy can actually trigger headaches in sensitive people, and knowing which ones to watch for is just as useful as knowing what to eat. The main culprits contain tyramine, a compound that builds up as foods age or ferment. Aged cheeses (cheddar, brie, blue cheese), cured meats like salami and pepperoni, and soy sauce are classic tyramine-heavy triggers.

Overripe fruits, dried fruits like raisins (which also contain sulfites), and bananas are less obvious sources. Beef and chicken liver, despite being rich in riboflavin, are also high in tyramine and may trigger headaches in some people. Alcohol, particularly red wine and beer, combines tyramine with histamine for a one-two punch that frequently causes headaches.

Not everyone reacts to these foods equally. If you suspect a food trigger but aren’t sure which one, an elimination approach works well: remove the most common offenders for a few weeks, then reintroduce them one at a time to identify your personal triggers.

Putting It Together

The most effective anti-headache diet isn’t about any single superfood. It’s a pattern: fatty fish two to three times a week, meals built around whole grains and legumes paired with protein and healthy fats, plenty of water, and consistent meal timing so your blood sugar never crashes. Add eggs, leafy greens, nuts, and yogurt for their riboflavin content, and keep fresh ginger on hand for when a headache starts creeping in.

At the same time, watch for aged, fermented, and heavily processed foods that might undo your efforts. The combination of eating more protective foods while reducing trigger foods gives you the best chance of fewer and milder headaches over time. Most people notice a difference within a few weeks of consistent changes, though nutrients like riboflavin and omega-3s take closer to three months to show their full preventive effect.