When a headache hits, eating the right foods can help it resolve faster, while the wrong ones can make it worse. The best choices are fresh, whole foods that rehydrate you, stabilize your blood sugar, and deliver key minerals like magnesium and potassium. Equally important: knowing which foods to skip until the pain passes.
Start With Water and Hydrating Foods
Dehydration is one of the most common and overlooked headache triggers. The Cleveland Clinic recommends six to eight glasses of water daily (about 1.5 to 2 liters), but if you’re already in pain, you likely need to catch up. Sip water steadily rather than gulping it all at once, and if you’ve been sweating, add a low-sugar sports drink to replace lost electrolytes.
Foods with high water content can supplement what you drink. Watermelon is 92% water, tomatoes come in at 94%, and strawberries sit at 92%. These aren’t replacements for a glass of water, but they help top off your fluid levels while also delivering fiber, vitamin C, and potassium, a mineral that supports the fluid balance your body needs to function without pain.
Magnesium-Rich Foods for Relief
Magnesium plays a direct role in headache prevention and relief. People who get frequent migraines tend to have lower magnesium levels, and the American Migraine Foundation notes that supplemental magnesium at 400 to 600 mg per day is commonly used to prevent migraines. You don’t need to reach for a pill during an active headache, but eating magnesium-rich foods regularly can reduce how often headaches occur in the first place.
Good sources include pumpkin seeds, almonds, cashews, spinach, black beans, and dark chocolate. A single ounce of pumpkin seeds delivers roughly 150 mg of magnesium. Tossing spinach into a meal or snacking on a handful of almonds are easy ways to build your intake over the course of a day.
Pair Carbs With Protein to Steady Blood Sugar
Skipping meals or going too long without eating causes your blood sugar to drop, and that drop frequently triggers a headache. The fix isn’t reaching for candy or a sugary snack, which spikes blood sugar and then crashes it again. Instead, choose complex carbohydrates that raise your blood sugar slowly: sweet potatoes, oatmeal, lentils, beans, or whole grain bread.
Pairing those carbs with a protein source makes a real difference. Adding a handful of nuts, some cheese (if it’s not aged), eggs, or lean meat slows digestion further and keeps your blood sugar stable for hours. This is especially relevant if your headache came on after a missed meal or a long gap between eating. A small, balanced snack can start easing the pain within 20 to 30 minutes.
Omega-3 Fats May Reduce Headache Severity
A study funded by the National Institutes of Health found that people who increased their intake of omega-3 fatty acids (the type found in fatty fish) experienced fewer and less severe headaches over 16 weeks. The benefit was even greater when participants also reduced their intake of omega-6 fatty acids, which are concentrated in vegetable oils like corn, soybean, and sunflower oil.
Salmon, sardines, mackerel, and trout are the richest food sources of the specific omega-3s involved (EPA and DHA). Walnuts and flaxseeds contain a plant-based omega-3, though the body converts it less efficiently. If you get headaches regularly, shifting your diet toward more fish and fewer fried or processed foods cooked in vegetable oil is one of the more evidence-backed dietary changes you can make.
Ginger for Active Headache Pain
Ginger has real evidence behind it for headache relief, not just folk remedy status. In a clinical trial published in Phytotherapy Research, 250 mg of powdered ginger performed as well as a standard migraine medication at reducing pain two hours after treatment. Both groups saw nearly identical drops on a pain scale.
You can get ginger through fresh ginger tea (steep a few thin slices in hot water for 10 minutes), ground ginger added to food, or even ginger chews. It also settles nausea, which often accompanies bad headaches. This makes ginger one of the more useful things to reach for when you’re in the middle of an episode.
Caffeine: Helpful in Small Doses, Harmful in Excess
A small amount of caffeine can genuinely help a headache. It narrows blood vessels and enhances the absorption of pain relievers, which is why it’s an ingredient in many over-the-counter headache medications. A cup of coffee or tea at the onset of a headache can take the edge off.
The problem starts with regular use. According to Stanford Health Care, caffeine dependency can develop after as little as seven consecutive days of use, and doses as low as 100 mg per day (roughly one cup of coffee) are enough to sustain that dependency. Once your brain expects caffeine and doesn’t get it, withdrawal kicks in, and headache is the most prominent symptom. If you find yourself needing caffeine every day to avoid a headache, that’s a sign you’ve crossed into rebound territory. Gradually tapering down is the way out.
Foods to Avoid During a Headache
Certain compounds in food are well-established headache triggers, and eating them during an active headache can extend or intensify it. The University of Wisconsin’s headache elimination diet identifies several major categories to watch.
- Aged cheeses and fermented dairy: The older the cheese, the more tyramine it contains. Parmesan, cheddar, blue cheese, brie, and feta are common culprits. Yogurt, sour cream, and buttermilk can also be problematic.
- Processed and cured meats: Hot dogs, bacon, salami, pepperoni, beef jerky, and deli meats preserved with nitrates or nitrites are frequent triggers.
- MSG-containing foods: Restaurant soups, flavored snack foods, seasoned salts, bouillon cubes, and many processed or canned foods. Labels that say “natural flavoring” sometimes indicate MSG.
- Fermented soy products: Miso, tempeh, and soy sauce (which often contains MSG as well).
- Fresh yeast-risen baked goods: Sourdough, bagels, doughnuts, and soft pretzels baked less than a day ago can be triggers for some people.
A useful rule of thumb from headache specialists: eat young, fresh, natural foods. The more aged, fermented, or heavily processed something is, the more likely it contains compounds that worsen headaches.
Nutrients Worth Building Into Your Routine
If headaches are a recurring problem for you, two nutrients have strong enough evidence to be worth mentioning alongside magnesium. Riboflavin (vitamin B2), taken at 400 mg daily, is commonly recommended by headache specialists for migraine prevention. It’s found naturally in eggs, lean meats, and fortified cereals, though reaching preventive doses typically requires a supplement.
Coenzyme Q10, a compound your body produces naturally, has also shown promise in reducing migraine frequency. Clinical studies have tested it at doses ranging from 100 to 400 mg daily. Food sources include organ meats, fatty fish, and whole grains, but again, supplementation is usually needed to reach the levels studied.
Neither of these will stop a headache that’s already happening. They work over weeks and months to reduce how often headaches strike. Think of them as long-term investments if headaches are a regular part of your life.

