What to Eat and Avoid When You Have a Headache

When a headache hits, what you eat and drink can either speed up relief or make things worse. Dehydration and low blood sugar are two of the most common headache triggers, so the fastest dietary fix is often a tall glass of water paired with a small, balanced meal. Beyond that quick first step, certain nutrients have solid evidence behind them for both immediate relief and long-term prevention.

Start With Water

Dehydration is one of the simplest and most overlooked causes of headaches. When your body loses more fluid than it takes in, the brain can temporarily shrink and pull away from the skull, irritating pain-sensitive structures around it. The good news: relief from a dehydration headache can begin within minutes of drinking water. Aim for 2 to 3 liters of total fluid intake throughout the day, and if you’re already in pain, drink a full glass or two right away.

If plain water doesn’t appeal to you, water-rich foods can help close the gap. Cucumbers and iceberg lettuce are 96% water. Celery, radishes, and watercress come in at 95%. Tomatoes, zucchini, and romaine lettuce hover around 94%. Watermelon, strawberries, and bell peppers sit at about 92%. A simple salad or a bowl of sliced melon can meaningfully contribute to your hydration while also providing vitamins and minerals that support recovery.

Eat Something to Stabilize Blood Sugar

Skipping meals is a well-documented headache trigger. When blood sugar drops too low, your body releases stress hormones that can cause throbbing head pain. The fix isn’t a candy bar, which would spike your blood sugar and then crash it again. Instead, reach for complex carbohydrates that release energy slowly: oatmeal, whole grain bread, sweet potatoes, lentils, or beans. Pairing these with a source of protein or healthy fat (eggs, nut butter, avocado) slows digestion further and keeps your blood sugar steady for hours.

If you’re too nauseated for a full meal, even a banana with a handful of almonds or a small bowl of oatmeal can be enough to reverse a hunger-related headache.

Magnesium-Rich Foods

Magnesium plays a central role in nerve signaling and blood vessel function, and low levels are consistently linked to headaches, especially migraines. International and American headache societies recommend 400 to 600 mg of magnesium daily for migraine prevention. Many people fall short of even the baseline recommendation of 310 to 400 mg per day.

You can close that gap through food. Pumpkin seeds are one of the most concentrated sources, delivering about 150 mg per ounce. Dark chocolate (70% cacao or higher) provides roughly 65 mg per ounce. Spinach, Swiss chard, black beans, and almonds are all strong sources. Eating these foods regularly won’t stop a headache in the moment the way water can, but building up your magnesium stores over weeks reduces how often headaches strike in the first place.

Omega-3 Fatty Acids

A diet high in omega-3 fats and low in omega-6 fats (the kind found in vegetable oils, fried foods, and processed snacks) can reduce headache frequency by about two days per month and noticeably lower pain intensity. Omega-3s help the body produce compounds that dial down inflammation and reduce pain signaling in the nervous system.

The richest food sources are fatty fish: salmon, mackerel, sardines, and anchovies. Two to three servings per week is a reasonable target. Walnuts, flaxseeds, chia seeds, and hemp seeds provide a plant-based form of omega-3, though the body converts it less efficiently. If your current diet leans heavily on fried foods, chips, and cooking oils like corn or soybean oil, shifting that balance toward omega-3-rich foods is one of the most impactful dietary changes you can make for chronic headaches.

Ginger for Acute Relief

Ginger has genuine evidence behind it, not just folk remedy status. In a clinical trial of 100 migraine patients, ginger powder performed as well as sumatriptan, a standard prescription migraine drug, at reducing headache severity within two hours. A quarter teaspoon of powdered ginger stirred into hot water or tea is a practical dose. Fresh ginger sliced into hot water works too, though the concentration is harder to control. Ginger also helps with the nausea that often accompanies headaches, making it doubly useful.

The Caffeine Question

Caffeine is a double-edged sword for headaches. In the right dose, it narrows blood vessels and boosts the effectiveness of pain relievers. Research shows that around 100 to 130 mg of caffeine (roughly one strong cup of coffee) enhances analgesic effects for both tension headaches and migraines. Doses below 60 mg generally don’t produce a reliable benefit.

The catch is that regular caffeine use creates dependence quickly. Consuming 200 mg or more daily for two weeks is enough to set up withdrawal headaches, which typically hit 12 to 24 hours after your last dose and affect about half of regular caffeine users. If you already drink coffee daily, a cup during a headache may simply be reversing withdrawal rather than treating the underlying problem. And overusing caffeine-containing pain relievers can lead to medication overuse headache, a cycle where the treatment itself becomes the trigger. The safest approach is to keep daily caffeine intake moderate and inconsistent, so your body doesn’t build dependence.

B Vitamins for Prevention

Riboflavin (vitamin B2) has strong evidence as a migraine preventive. In clinical studies, 400 mg of riboflavin daily cut headache frequency in half, from four days per month to two, after about three months of consistent use. That dose is far higher than what you’d get from food alone, so supplementation is typically necessary for therapeutic effects. But regularly eating riboflavin-rich foods like eggs, lean meats, fortified cereals, mushrooms, and almonds still supports overall nerve health and contributes to your baseline intake.

The American Migraine Foundation considers riboflavin and magnesium the two most recommended nutritional approaches for migraine prevention, citing strong clinical evidence and minimal side effects. Coenzyme Q10 is another option with some supporting evidence, found in organ meats, fatty fish, and whole grains.

Foods to Avoid During a Headache

Certain foods can worsen an active headache or trigger new ones. The biggest offenders contain tyramine or histamine, two compounds that affect blood vessel dilation and pain signaling.

  • Aged cheeses (blue cheese, brie, cheddar, parmesan) are high in tyramine, which builds up as proteins break down during aging.
  • Alcohol, especially red wine, contains both histamine and tyramine. White wine is lower in tyramine but still carries histamine.
  • Processed meats (hot dogs, salami, bacon) contain nitrates that can dilate blood vessels and intensify head pain.
  • Fermented foods like soy sauce, kimchi, and sauerkraut are high in histamine.
  • Chocolate is a commonly reported trigger, though individual sensitivity varies widely.

If you’re already dealing with a headache, it’s worth skipping these until you feel better. For chronic headache sufferers, keeping a food diary for a few weeks can help identify which of these (if any) are personal triggers. Not everyone reacts to the same foods, so blanket elimination isn’t necessary unless you’ve confirmed a pattern.

Putting It Together

For an active headache, the most effective immediate steps are drinking water, eating a balanced snack with complex carbohydrates and protein, and trying ginger tea. For long-term prevention, building your diet around magnesium-rich foods, omega-3 fatty acids, and adequate hydration makes the biggest difference. These aren’t dramatic changes. A breakfast of oatmeal with walnuts and berries, a lunch with salmon and leafy greens, and consistent water intake throughout the day covers most of the nutritional bases that research connects to fewer, milder headaches.