Drinking water is the single most effective first step when you have a headache. Dehydration causes brain tissue to pull away from pain-sensitive structures inside your skull, and for many people, drinking fluids brings relief within minutes. Beyond hydration, certain foods can help ease a headache while others can make it worse.
Start With Water
Even mild dehydration can trigger or intensify a headache. When your body is low on fluids, the resulting shift in fluid balance causes your brain tissue to exert traction on the membranes and blood vessels surrounding it, which generates pain. The good news is that this type of headache often resolves quickly once you start drinking.
Aim for about 2 liters of water throughout the day. Women who consistently hit that target in studies experienced less severe and shorter migraine attacks, along with fewer episodes overall. If you suspect your headache is partly from not drinking enough, have a full glass or two right away. Don’t rely on coffee or soda as your primary fluid source.
Eat Something With Protein and Complex Carbs
Skipping meals or going too long without eating can cause your blood sugar to drop, bringing on a headache along with shakiness and difficulty concentrating. If it’s been more than three or four hours since your last meal, eating is a priority.
What matters here is pairing carbohydrates with protein and a little fat so your blood sugar rises steadily instead of spiking and crashing. Good options when you have a headache include:
- Eggs with whole-grain toast
- Greek yogurt with fruit and granola
- Crackers with cheese or hummus
- A handful of nuts with a piece of fruit
- Peanut butter on toast with a glass of milk
Sugary snacks like candy or soda can make things worse. They spike your blood sugar fast, then drop it just as quickly, which can intensify your headache or trigger a new one once the crash hits.
Magnesium-Rich Foods
Magnesium plays a role in nerve signaling and blood vessel function, and people who get frequent headaches often have lower levels. Research links insufficient magnesium intake with higher rates of migraine and severe headaches in adults aged 20 to 50. Major headache societies recommend 400 to 600 mg of magnesium daily for migraine prevention.
You don’t need a supplement to start getting more. Foods naturally high in magnesium include pumpkin seeds, almonds, spinach, black beans, dark chocolate, and avocado. A cup of cooked spinach delivers roughly 150 mg, and an ounce of pumpkin seeds provides about the same. Regularly eating these foods won’t necessarily stop a headache that’s already started, but building them into your diet can reduce how often headaches occur over time.
Fatty Fish and Omega-3s
A study funded by the National Institutes of Health found that people who ate more fatty fish over 16 weeks experienced fewer and less severe migraines. The key nutrients are EPA and DHA, two omega-3 fatty acids found in salmon, sardines, mackerel, and trout. Your body converts these into compounds called oxylipins that reduce pain signaling. Meanwhile, omega-6 fatty acids, which are abundant in vegetable oils and processed foods, get converted into oxylipins that increase pain.
The practical takeaway: eating fatty fish two or three times a week while cutting back on fried foods and dishes cooked in corn or soybean oil shifts the balance toward pain-reducing compounds in your body. This is more of a long-term strategy than an acute fix, but the effects were measurable within a 16-week study period.
Ginger
If you’re looking for something to help with a headache right now, ginger is worth trying. A clinical trial found that ginger powder was statistically comparable to sumatriptan, a common prescription migraine medication, for treating acute migraine attacks. Fresh ginger tea is easy to make: slice a thumb-sized piece of fresh ginger, steep it in hot water for 10 minutes, and add honey if you like. Powdered ginger stirred into warm water works too.
Riboflavin Over Time
Riboflavin, also called vitamin B2, has solid evidence behind it for reducing how often migraines happen. In a randomized trial, 400 mg per day reduced migraine frequency by two attacks per month compared to placebo. The Canadian Headache Society recommends that same dose for prevention, noting minimal side effects beyond yellow-tinted urine.
You won’t get 400 mg from food alone, since even the richest dietary sources top out well below that. But regularly eating riboflavin-rich foods still supports your baseline levels. The best sources are eggs, yogurt, milk, lean meats, and fortified cereals. A cup of fortified oats delivers about 1.1 mg, and a cup of plain yogurt provides around 0.6 mg. If you get frequent headaches, a B2 supplement may be worth discussing with your doctor, since the effective dose for prevention is far above what diet provides.
Be Careful With Caffeine
A small amount of caffeine can help a headache. Combined with a standard pain reliever, doses of 100 mg or more (roughly one cup of coffee) have been shown to improve pain relief. But caffeine alone, without an analgesic, didn’t outperform placebo in studies.
The bigger issue is what happens when caffeine becomes a habit. If you regularly consume more than 200 mg per day (about two cups of coffee) and then skip it, you can develop a withdrawal headache within 24 hours. That headache resolves within an hour of having caffeine again, which creates a cycle that’s hard to break. If you drink caffeinated beverages, keeping your daily intake under 200 mg and as consistent as possible from day to day helps prevent this pattern.
Foods That Can Make a Headache Worse
While you’re dealing with a headache, certain foods contain compounds that can lower your pain threshold or intensify what you’re already feeling. The main culprits are:
- Tyramine: Found in aged cheeses, chicken and beef liver, dried fruits like raisins, and overripe bananas or avocados. Tyramine levels increase as foods age or ferment.
- Nitrates and nitrites: Common in processed meats like hot dogs, bacon, salami, pepperoni, bologna, beef jerky, and smoked fish.
- MSG (monosodium glutamate): Found in many restaurant dishes, canned soups, bouillon, seasoned snacks, gravies, and ready-to-eat meals.
- Aspartame: The artificial sweetener in diet sodas and many sugar-free products.
These chemicals create what researchers call a “trigger load.” On their own, one of these compounds might not cause a problem. But combined with other triggers like stress, poor sleep, or dehydration, they can push you over the threshold into a headache or make an existing one harder to shake. When you already have a headache, it’s best to avoid these foods until you’re feeling better.
Putting It Together
For immediate relief, drink a large glass of water, eat a balanced snack if you haven’t eaten recently, and try ginger tea. A single cup of coffee alongside a pain reliever can help, but don’t rely on caffeine alone. Avoid processed meats, aged cheese, and anything with artificial sweeteners while your head is hurting.
For the longer term, the pattern that emerges from the research is straightforward: eat regular meals so your blood sugar stays stable, drink enough water, include fatty fish a few times a week, load up on magnesium-rich foods like nuts, seeds, and leafy greens, and keep caffeine intake low and consistent. These changes won’t eliminate every headache, but over weeks they meaningfully reduce how often headaches show up and how bad they feel when they do.

