Certain foods can genuinely help relieve a headache or shorten its duration, while others will make it worse. The most effective choices work by addressing the common physiological triggers behind headaches: dehydration, low magnesium, blood sugar drops, and inflammation. Here’s what to reach for and what to skip.
Start With Water and Electrolytes
Dehydration is one of the most common and overlooked headache triggers. When your body loses too much fluid, cells throughout the brain shrink slightly as water moves out of them and into the surrounding space. This physical change is enough to trigger pain. The fix is straightforward: drink water, but pair it with something that contains electrolytes (sodium, potassium, magnesium) so your body actually retains the fluid rather than flushing it through.
Good options include coconut water, a banana with a pinch of salt, or broth-based soup. Watermelon, cucumbers, and oranges are also useful because they deliver both water and minerals at the same time. If your headache came on after exercise, alcohol, or simply forgetting to drink enough during the day, rehydrating may be the only intervention you need.
Magnesium-Rich Foods
Magnesium plays a direct role in headache prevention. People who get frequent headaches tend to have lower magnesium levels, and supplementation at 400 to 600 mg per day is a standard recommendation from headache specialists. But you can also boost your intake through food, which is especially helpful during an active headache.
The best food sources of magnesium include pumpkin seeds (one ounce delivers about 150 mg), spinach, Swiss chard, dark chocolate, almonds, and avocado. A practical headache snack might be a handful of pumpkin seeds with a square of dark chocolate, or a smoothie with spinach and banana. These won’t replace a supplement if you get chronic headaches, but they can make a meaningful difference in the moment.
Omega-3 Fats From Fish and Seeds
Your body converts omega-3 fatty acids from food into compounds that actively reduce pain signaling. Research from the National Institutes of Health found that people who ate diets higher in omega-3s experienced fewer and less severe headaches. The mechanism is specific: omega-3s produce pain-reducing molecules in the body, while omega-6 fats (common in processed vegetable oils) produce pain-increasing ones.
Salmon, sardines, mackerel, and trout are the richest sources. If you don’t eat fish, flaxseeds, chia seeds, and walnuts provide a plant-based form of omega-3. This is more of a long-term strategy than an instant fix, but if you’re eating during a headache anyway, choosing salmon over a processed meal tilts your body’s chemistry in the right direction.
Ginger Works Surprisingly Well
One clinical trial published in Phytotherapy Research compared ginger powder to sumatriptan, a common migraine medication. The results were striking: ginger reduced headache severity by a nearly identical amount, and participants reported fewer side effects. The study used about a quarter teaspoon of powdered ginger dissolved in water, taken at the onset of the headache.
Fresh ginger tea is easy to make. Slice a thumb-sized piece of ginger root, steep it in hot water for 10 minutes, and add honey if you like. You can also grate fresh ginger into a smoothie or stir powdered ginger into warm water. It’s one of the few foods with clinical evidence supporting its use during an active headache, not just for prevention.
Keep Your Blood Sugar Steady
Skipping meals is a reliable way to trigger a headache. When blood sugar drops, your brain notices immediately because it depends on a constant supply of glucose. The resulting headache tends to feel dull and diffuse, often paired with irritability and difficulty concentrating.
The solution isn’t to grab something sugary, which causes a spike followed by another crash. Instead, pair a complex carbohydrate with protein or healthy fat to keep blood sugar stable over several hours. Good combinations include:
- Whole-grain toast with avocado (healthy fats plus fiber)
- Greek yogurt with berries (protein plus antioxidants)
- Hummus with carrots (protein plus hydration)
- Almonds with a banana (magnesium plus potassium)
- Oatmeal with nut butter (slow-releasing carbs plus fat)
If you’re prone to headaches, eating small meals every three to four hours is more protective than eating two or three large meals with long gaps between them.
Caffeine: Helpful in Small Amounts, Harmful in Large Ones
Caffeine narrows blood vessels and can genuinely relieve a headache, which is why it’s an ingredient in many over-the-counter pain relievers. But the relationship is tricky. Regular caffeine consumption changes your brain’s baseline, and skipping your usual cup can trigger a withdrawal headache within 12 to 24 hours.
The American Migraine Foundation recommends limiting caffeine to one or two beverages per day, or roughly 200 mg. That’s about one medium coffee or two cups of black tea. If you already have a headache and you normally drink caffeine, having your usual amount may help. If you don’t normally consume it, a small cup of green tea or black tea can provide a mild boost without overdoing it. The key is consistency: drinking wildly different amounts from day to day is a common trigger.
Foods to Avoid During a Headache
Certain foods contain tyramine, a compound that forms naturally when proteins break down over time. Tyramine affects blood vessels and can intensify a headache that’s already underway. Tyramine levels are highest in foods that are aged, fermented, cured, or stored for long periods.
While you have a headache, it’s worth avoiding:
- Aged cheeses like blue cheese, brie, cheddar, Swiss, and Roquefort
- Cured meats like pepperoni, salami, and smoked or pickled fish
- Fermented foods like sauerkraut, miso, soy sauce, and kimchi
- Alcohol, particularly red wine, beer, and sherry
- Processed foods containing MSG, nitrates, or yeast extract
Fresh foods are generally safe. The longer something has been sitting, fermenting, or aging, the more tyramine it contains. A fresh chicken breast is fine; deli meat that’s been in the package for a week is not.
Nutrients That Prevent Headaches Long-Term
If headaches are a recurring problem, two nutrients are worth building into your regular diet. Riboflavin (vitamin B2) at 400 mg per day for at least three months has been shown to reduce migraine frequency, and it’s included in UK clinical guidelines as a preventive treatment. Food sources include eggs, lean beef, mushrooms, and fortified cereals, though reaching therapeutic levels typically requires a supplement.
Coenzyme Q10 is another compound that supports energy production in brain cells and reduces inflammatory markers associated with headaches. Your body makes some on its own, but levels decline with age. Organ meats, fatty fish, and whole grains contain small amounts. Like riboflavin, meaningful headache prevention usually requires supplemental doses, but dietary sources still contribute.
For day-to-day prevention, the simplest approach is eating regular meals built around whole foods, staying hydrated, keeping caffeine consistent, and prioritizing magnesium-rich foods like leafy greens, seeds, and nuts. Many people who clean up these basics find their headache frequency drops noticeably within a few weeks.

