There is no single food that cures every headache, but certain foods and drinks can help prevent or ease them. Water is the most important one. Dehydration is a common headache trigger, and drinking enough fluids can stop many headaches before they start. Foods rich in magnesium, like spinach and almonds, and those with riboflavin (vitamin B2), like eggs and dairy, also show real promise for headache prevention.
What Food Helps Headaches the Most?
The most direct answer is water. Many headaches are caused by mild dehydration. When your body lacks fluids, your brain tissue can temporarily shrink and pull away from the skull, which triggers pain receptors.
Studies consistently show that increasing water intake reduces headache frequency and intensity in people who are prone to dehydration headaches. If you feel a headache coming on and you have not drunk much today, start with a full glass of water.
Beyond water, foods rich in magnesium are the next best choice. Magnesium relaxes blood vessels and blocks pain signals in the brain. Some research suggests that people who get migraines often have lower magnesium levels than those who do not.
Good magnesium sources include:
- Spinach and other dark leafy greens
- Almonds and cashews
- Black beans and lentils
- Avocado
- Dark chocolate (70% cacao or higher)
Can Certain Foods Prevent Migraines?
Yes, but prevention is different from quick relief. Foods do not stop a migraine that has already started. They work over weeks or months to reduce how often migraines happen.
Riboflavin, also called vitamin B2, has the strongest evidence for migraine prevention. It helps your cells produce energy, and migraine brains appear to have an energy deficit. Some clinical trials have found that daily riboflavin supplements reduce migraine frequency by about half in many people.
Foods high in riboflavin include eggs, milk, yogurt, lean meats, and fortified cereals. You would need to eat a lot of these foods daily to match the supplement dose used in studies, but including them in your diet is a reasonable step.
Coenzyme Q10 is another compound with some evidence for migraine prevention. It is found in fatty fish, organ meats, and whole grains. Like riboflavin, it supports cellular energy production. Some studies show it reduces migraine frequency, though the evidence is not as strong as it is for riboflavin.
What Foods Trigger Headaches?
Understanding triggers is just as important as knowing what helps. For many people, certain foods reliably bring on headaches within hours.
The most common dietary triggers include:
- Aged cheeses like cheddar, parmesan, and blue cheese
- Processed meats like bacon, salami, and hot dogs
- Alcohol, especially red wine
- Artificial sweeteners, particularly aspartame
- Monosodium glutamate (MSG) in processed foods
- Chocolate — though this affects only some people
- Caffeine — both too much and sudden withdrawal can trigger headaches
The mechanism behind most triggers involves changes in blood vessel diameter or shifts in brain chemicals like serotonin. Aged cheeses and processed meats contain tyramine and nitrates, compounds that can dilate blood vessels and set off pain pathways.
Not everyone reacts to the same foods. If you suspect a trigger, keep a headache diary for one month. Write down what you ate in the six hours before each headache. Patterns usually become clear within a few weeks.
Does Caffeine Help or Hurt Headaches?
Caffeine is a double-edged sword. It can relieve a headache and it can cause one.
For relief, caffeine constricts blood vessels in the brain. This is why many over-the-counter headache medications include caffeine as an active ingredient. Acetaminophen and ibuprofen work better for some people when combined with caffeine.
But regular caffeine use creates dependency. When you skip your usual coffee, blood vessels dilate and you get a withdrawal headache. This usually starts within 24 hours of your last cup and resolves once you have caffeine again.
The practical advice is to keep caffeine intake consistent. If you drink coffee, drink roughly the same amount at roughly the same time each day. Sudden changes — more or less — can trigger headaches.
How Fast Can Food Help a Headache?
Food cannot stop a headache that has already started, with one exception: low blood sugar. If your headache comes from skipping a meal, eating something will usually help within 15 to 30 minutes.
For other types of headaches, food works on a prevention timeline. Magnesium and riboflavin take several weeks of consistent intake before you notice fewer headaches. This is not a quick fix. It is a dietary pattern that reduces your overall risk over time.
If you get frequent headaches, the fastest relief comes from:
- Drinking water if you are dehydrated
- Eating a balanced meal if you have not eaten in hours
- Taking an over-the-counter pain reliever as directed
- Resting in a quiet, dark room
What Should You Eat During a Headache?
When a headache is already happening, the goal is not to find a miracle food. The goal is to avoid making things worse.
Eat something light and easy to digest. Crackers, toast, rice, or a banana are good options. These provide steady glucose without triggering the blood sugar spikes that can worsen pain.
Avoid anything with strong smells or flavors. Aromatic foods can intensify nausea, which often accompanies migraines. Also avoid foods that require much chewing, since jaw tension can make headache pain worse.
Ginger deserves special mention. Some research suggests ginger can reduce migraine pain intensity similar to a common prescription medication. You can drink ginger tea or chew crystallized ginger. It is not a cure, but it is a safe option that may help, especially if you feel nauseous.
Are There Foods That Make Headaches Worse?
Yes, beyond the classic triggers, some eating patterns worsen headaches even if specific foods do not trigger them.
Skipping meals is a major headache trigger. Low blood sugar causes the brain to release stress hormones, which can set off a headache. Eating regular meals, even small ones, helps keep blood sugar stable.
Very cold foods can trigger what is commonly called brain freeze. This is a brief headache caused by rapid cooling of the roof of the mouth. It usually resolves within a minute or two. If you are prone to migraines, brain freeze may sometimes set off a longer migraine episode.
Excess sodium can contribute to headaches by increasing blood pressure and causing fluid shifts. Processed and restaurant foods are the main sources of excess sodium in the typical diet.
What About Supplements for Headaches?
Supplements are not food, but they are commonly used for headache prevention. The evidence varies by supplement.
Magnesium has the strongest evidence, particularly magnesium citrate or glycinate. Some studies show it reduces migraine frequency by about 40 percent. The typical dose used in studies is 400-500 mg daily, but you should check with your doctor first, especially if you have kidney problems.
Riboflavin at 400 mg daily has also shown benefit in clinical trials. This dose is much higher than what you get from food, which is why supplements are used for prevention.
Coenzyme Q10 and feverfew have more limited evidence. Some studies show benefit, others do not. The evidence is not strong enough to recommend them as first-line treatment.
One important note: supplements are not regulated like medications. Quality varies between brands. Look for products that have been independently tested by a third party, and always tell your doctor what you are taking.
Frequently Asked Questions
What should I eat first when a headache starts?
Drink a full glass of water first. If you have not eaten in several hours, eat something light like crackers or a banana to raise your blood sugar.
Can drinking more water prevent headaches?
Yes, if your headaches are linked to dehydration. Studies show that increasing daily water intake reduces headache frequency and intensity in people who do not drink enough fluids.
Is chocolate a headache trigger or a cure?
For most people, chocolate is a trigger, not a cure. Some people react to compounds in chocolate, though others can eat it without any problem.
How long does it take for dietary changes to reduce headaches?
Most people need two to three months of consistent dietary changes before they notice a clear reduction in headache frequency. Magnesium and riboflavin work slowly, not immediately.

