Drinking water and eating a balanced meal are the two fastest dietary fixes for most headaches. Many headaches are triggered or worsened by dehydration, low blood sugar, or both, so addressing those basics often brings relief within 30 minutes to an hour. Beyond the immediate fix, certain nutrients can reduce how often headaches strike in the first place.
Start With Water
Dehydration is one of the most common and most overlooked headache triggers. When your body loses more fluid than it takes in, blood volume drops and the brain temporarily contracts, pulling away from the skull and causing pain. The fix is simple: aim for six to eight glasses of water per day (roughly 1.5 to 2 liters). If you’re already in the middle of a headache, drink a full glass or two right away and continue sipping over the next hour.
If you’ve been sweating heavily, plain water may not be enough. You lose sodium and potassium through sweat, and replacing just the water without those electrolytes can slow your recovery. A low-sugar sports drink or a pinch of salt in water with a squeeze of citrus can help restore the balance faster.
Eat Something (Don’t Skip Meals)
Skipping meals, especially breakfast, causes blood sugar to drop. That drop triggers stress hormones like cortisol and adrenaline, which increase nerve activity in the brain and can set off a headache or migraine. The American Migraine Foundation identifies delayed or missed meals as one of the most reliable migraine triggers, and research consistently shows that irregular meal patterns are strong predictors of attacks in people with chronic headaches.
If you already have a headache and haven’t eaten in several hours, a small balanced meal combining protein, healthy fat, and complex carbohydrates will stabilize your blood sugar more effectively than a sugary snack. Think eggs on whole-grain toast, a handful of nuts with fruit, or yogurt with oats. Going forward, eating at consistent intervals throughout the day is one of the simplest preventive strategies available.
Magnesium-Rich Foods
Magnesium plays a key role in nerve function and blood vessel regulation, and low levels are frequently found in people who get migraines. A daily intake of 600 mg of magnesium has been shown to reduce migraine frequency, and it’s considered a safe, low-cost prevention strategy. While that dose is hard to hit through food alone, regularly eating magnesium-rich foods builds a solid baseline.
Your best whole-food sources include pumpkin seeds, almonds, spinach, black beans, dark chocolate, and avocado. A single ounce of pumpkin seeds delivers about 150 mg of magnesium, nearly 40% of most adults’ daily needs. Adding a few of these foods to your regular rotation can meaningfully raise your intake over time.
Omega-3 Fatty Acids
A clinical trial funded by the National Institutes of Health assigned 182 people with frequent migraines to different diets for 16 weeks. Those who ate more omega-3 fatty acids (found in fatty fish) experienced fewer headache days per month, fewer hours of headache overall, and less severe pain compared to people eating a typical American diet. The benefits were even stronger when participants also reduced their intake of omega-6 fats, the type concentrated in vegetable oils, fried foods, and processed snacks.
Salmon, sardines, mackerel, and herring are the richest food sources of the omega-3s used in the study. Eating fatty fish two to three times per week is a reasonable target. Walnuts, flaxseeds, and chia seeds provide a plant-based form of omega-3, though the conversion to the active forms in your body is less efficient.
Caffeine: Helpful in Small Doses
Caffeine narrows blood vessels and boosts the effectiveness of pain relievers, which is why it’s an ingredient in many over-the-counter headache medications. Research shows that roughly 100 to 130 mg of caffeine (about one regular cup of coffee) can enhance pain relief for both tension headaches and migraines.
The catch is that regular caffeine use sets you up for withdrawal headaches. Consuming as little as 100 mg daily for a week can create dependence, and stopping suddenly often triggers a rebound headache. If you use caffeine to treat a headache, keep it occasional: no more than two to three days per week. People who drink coffee every day and want to cut back should taper gradually rather than quitting cold turkey.
B Vitamins, Especially Riboflavin
Riboflavin (vitamin B2) is one of the better-studied nutrients for migraine prevention. In a randomized trial, 400 mg per day of riboflavin reduced migraine frequency by about two attacks per month compared to a placebo. The Canadian Headache Society recommends this dose for prevention, noting that side effects are minimal (the most common one is bright yellow urine).
Getting 400 mg from food alone is impractical since even beef liver, the richest natural source, provides only about 2.9 mg per serving. But building a riboflavin-rich diet still helps. Yogurt, milk, eggs, lean beef, and clams are all good sources. For people with frequent migraines, a supplement is the realistic way to reach therapeutic levels.
Ginger for Quick Relief
Ginger has natural compounds that block the same inflammatory pathways involved in headache pain. One clinical trial found that ginger powder was comparable in effectiveness to a common prescription migraine medication for reducing pain within two hours, with fewer side effects. You can grate fresh ginger into hot water for a tea, add it to a smoothie, or chew on a small piece of crystallized ginger when a headache starts. It also helps with the nausea that often accompanies migraines.
Foods That May Trigger Headaches
What you avoid can matter as much as what you eat. Certain foods contain compounds that affect blood vessels or neurotransmitter activity in the brain, and for sensitive individuals, these act as direct headache triggers.
The most commonly identified triggers in research include:
- Aged cheeses and cured meats: high in tyramine and histamine, both of which can dilate blood vessels
- Chocolate and cocoa: contain dopamine-related compounds that trigger migraines in some people
- Red and white wine, beer: combine histamine, sulfites, and alcohol, a triple threat for headache-prone individuals
- Soy sauce, ketchup, and other condiments: often contain both histamine and tyramine
- Processed and canned foods: frequently contain preservatives like nitrates that trigger headaches
Peanut butter, coffee cream, mayonnaise, and foods with red food dye have also been statistically linked to migraine attacks in clinical studies. Triggers are highly individual, though. Keeping a simple food diary for a few weeks, noting what you ate in the hours before a headache, is the most reliable way to identify your personal patterns.
Putting It All Together
If you have a headache right now, drink a large glass of water, eat a balanced meal if you’ve been fasting, try ginger tea, and consider a single cup of coffee if you don’t drink caffeine regularly. For longer-term prevention, the evidence points toward a diet rich in fatty fish, magnesium-heavy foods like nuts and seeds, and adequate riboflavin from dairy and lean meats. Equally important: eat on a regular schedule, stay hydrated throughout the day, and learn which specific foods tend to set off your headaches so you can avoid them.

