How to Avoid Migraines: Diet, Sleep, and Stress

Migraines are preventable more often than most people realize. About 27 to 30% of migraine patients can trace their attacks to specific food triggers alone, and lifestyle changes like consistent sleep, regular exercise, and stress management can cut attack frequency by half or more. The key is identifying your personal triggers and building daily habits that keep your threshold high.

Track Your Triggers With a Migraine Diary

Before you can prevent migraines, you need to know what sets yours off. Triggers vary enormously from person to person, so a headache diary is the single most useful starting tool. Each time you get a migraine, record what time the pain started, how long the attack lasted, and how severe it was. Then note the context: what you ate and drank that day, whether you slept poorly, and your stress level. Also track any medication you took, including the type and dose.

After a few weeks, patterns usually emerge. You might notice attacks cluster on days after poor sleep, or consistently follow a particular food. Without this record, you’re guessing, and most people guess wrong about their triggers.

Food and Drink Triggers to Watch For

Certain chemicals in food are well-established migraine triggers: tyramine (found in aged cheese, cured meats, smoked fish, and fermented foods), nitrates (in processed deli meats, hot dogs, and bacon), MSG, aspartame, and caffeine. Chocolate and alcohol round out the list of most commonly reported culprits.

Red wine stands out among alcoholic drinks. In one Danish study, 91% of migraine patients who identified alcohol as a trigger pointed to red wine, compared with 50% for liquor and just 18% for beer. That said, even red wine doesn’t trigger an attack every time. Only about 9% of patients reported a migraine after every glass, and fewer than half experienced one more than 50% of the time. This inconsistency is common across food triggers, which is why a diary matters more than a blanket elimination diet.

Nitrate-containing foods can cause headaches in two waves: a mild one within an hour of eating, or a more severe, migraine-like episode three to six hours later. If you eat a lot of processed meats, try switching to nitrate-free versions for a few weeks and see if your diary reflects a change.

Keep a Consistent Sleep Schedule

Irregular sleep is one of the most reliable migraine triggers. The goal isn’t just getting enough hours; it’s going to bed and waking up at the same time every day, including weekends and vacations. Your brain’s migraine threshold drops when your sleep-wake rhythm shifts. If you feel you need extra rest, a short nap is better than sleeping in late, because sleeping in disrupts the consistency that protects you.

Most adults with migraine do best with seven to eight hours. Both too little and too much sleep can provoke attacks, so aim for a predictable window rather than trying to “catch up” on weekends.

Exercise Regularly, but Build Up Gradually

Aerobic exercise is one of the most effective non-drug migraine preventives, but it has a catch: intense exertion can itself trigger an attack, especially if you’re not conditioned for it. The solution is starting at moderate intensity and building up.

A 2025 meta-analysis found that aerobic exercise significantly reduced both migraine pain intensity and attack frequency. The greatest benefit appeared at a cumulative dose of about 900 to 950 total minutes of exercise over the course of a program, with no additional benefit from doing more. In practical terms, that translates to three 30-minute sessions per week over roughly 10 to 11 weeks. A minimum of about 300 total minutes was needed before migraine frequency started to meaningfully drop.

Walking, cycling, swimming, and jogging all count. Warm up for at least five minutes, stay hydrated, and avoid exercising in extreme heat. If exercise has triggered your migraines before, start with lower intensity (brisk walking) and increase gradually over several weeks.

Stay Hydrated Throughout the Day

Dehydration is a commonly reported migraine trigger, and there’s evidence that simply drinking more water helps. In a pilot trial, migraine patients who added about 1.5 liters of water per day to their usual intake reduced total headache hours by roughly 21 hours over a two-week period, with a noticeable decrease in pain intensity as well.

You don’t need to force a specific number of glasses. A reasonable target is to drink enough that your urine stays pale yellow throughout the day. Carry a water bottle, and pay extra attention to hydration on hot days, after exercise, and after drinking alcohol or caffeine, all of which increase fluid loss.

Manage Stress Before It Builds

Stress itself triggers migraines, but so does the “let-down” period after stress passes, which is why weekend migraines are so common. You can’t eliminate stress, but you can change how your body responds to it.

Biofeedback and relaxation training can produce a 45 to 60% reduction in headache frequency and severity, according to the American Migraine Foundation. In biofeedback, you learn to consciously control physiological responses like muscle tension and skin temperature using real-time feedback from sensors. It typically takes several sessions to learn the techniques, but the skills are yours to use permanently. Newer approaches like mindfulness-based cognitive therapy and acceptance and commitment therapy are also showing promise for migraine prevention.

Even without formal training, regular relaxation practices help. Progressive muscle relaxation, deep breathing exercises, and consistent daily routines all lower the baseline stress level that contributes to migraine susceptibility.

Supplements With Evidence Behind Them

Three supplements have enough research to be recommended by headache specialists for migraine prevention:

  • Riboflavin (vitamin B2): 400 mg per day. At this dose, it can reduce migraine frequency over two to three months.
  • CoQ10: 300 mg per day has been shown to reduce migraine frequency in adults.
  • Magnesium: One of the most commonly used supplements for migraine prevention, particularly helpful for people with migraine with aura. Studies have found decreased magnesium levels in migraine patients, and supplementation can help by calming overexcited nerve signaling in the brain.

These supplements are generally well tolerated but take six to eight weeks of consistent use before you can judge whether they’re working. They can be used alongside other preventive strategies.

Hormonal Migraines in Women

Many women experience migraines tied to their menstrual cycle, typically occurring in the two days before through the first three days of their period. The trigger is the natural drop in estrogen levels. If your diary shows a clear menstrual pattern, there are targeted strategies worth discussing with your doctor.

Short-term preventive use of anti-inflammatory medications like naproxen, taken for several days around the start of your period, has been shown to reduce the number, duration, and intensity of menstrual migraine attacks. Estrogen supplementation through patches or gels around the time of menses can also help prevent the estrogen-withdrawal effect that triggers the attack. Hormonal contraceptives that reduce the frequency of periods are another option some women use to minimize the hormonal fluctuations altogether.

When to Consider Preventive Medication

If you’re getting more than three migraine attacks per month, or spending eight or more days with a headache each month, preventive medication is worth considering. The same applies if your migraines are severe and debilitating despite taking acute treatments, or if you find yourself reaching for pain medication so often that it’s becoming part of the problem (medication overuse itself worsens headaches over time).

Newer preventive treatments that target a protein called CGRP, which plays a central role in migraine pain signaling, have changed the landscape. Monthly or quarterly injections reduced migraine days by roughly one to two and a half days per month compared to placebo in clinical trials, and 42 to 59% of patients experienced at least a 50% reduction in migraine frequency. Daily oral versions also showed strong response rates.

Older preventive medications, including certain blood pressure drugs, antidepressants, and anti-seizure medications, remain effective options too. The right choice depends on your migraine pattern, other health conditions, and how you respond. Most preventive medications need two to three months before their full effect becomes clear, so patience with the process matters.

Putting It All Together

The most effective migraine prevention isn’t a single intervention. It’s a combination: consistent sleep, regular moderate exercise, adequate hydration, identified and avoided food triggers, and stress management. Supplements like magnesium and riboflavin add another layer. For people whose migraines remain frequent despite these measures, preventive medication can make a dramatic difference. Start with the diary, build the habits one at a time, and give each change enough weeks to show results before adding the next.