“You’re not going to be able to prevent all headaches,” says Mark Green, MD, a professor of neurology, anesthesiology, and rehabilitation and the director of the center for headache and pain medicine at the Icahn School of Medicine at Mount Sinai in New York City. That’s because there are headache triggers you can control and those you can’t. Some triggers in the latter category are the weather and, if you’re female, the hormonal fluctuations that occur with menstruation and perimenopause. The good news is you can minimize headaches and migraine attacks by managing your triggers, says Dr. Green. Even if you can’t stop every headache from happening, some simple changes can help you avoid at least a few.

What Causes a Migraine Attack?

Headaches and migraine attacks can be concerning for a lot of people, says Lauren Doyle Strauss, DO, a headache specialist and an assistant professor at Wake Forest Baptist Health in Winston-Salem, North Carolina. “People wonder, ‘Why am I getting a headache or migraine? What is causing such a big disturbance in my life?’” There have been a lot of advancements in the understanding of headache and pain mechanisms in the past decade, says Dr. Strauss. “It’s really exciting, and it’s allowed for some new therapeutics to be developed, such as CGRPs (calcitonin gene-related peptide) pathway monoclonal antibodies,” she says. CGRP antibodies are new medications that are approved as a preventive medication for migraine. “We’re learning new things and discovering new target sites, but unfortunately, we don’t fully understand the pathophysiology or all aspects of migraine and the related symptoms,” says Strauss. “There is a genetic component to migraine, where we see multiple family members who have the disease, and we suspect there are multiple genes related in the development of migraine or inheriting migraine,” she says. If one or both of your parents have migraine, there is a 50 to 75 percent chance that you will have the disease, too, according to the American Migraine Foundation. Although you can’t change your genetics, you can control some of the factors that trigger a headache or migraine. Here are some expert tips on keeping headaches and migraine attacks at bay.

1. Keep a Diary to Learn Your Personal Migraine Triggers

If you have frequent migraine attacks or headaches, it can be really helpful to track what you’re experiencing, says Strauss. The type of information you can track can include the following:

All medicines you takeWhat time you wake up and go to bedWhen you eat meals and snacksAll exercise and any other physical activities you undertakeAll beverages you drink, especially beverages with caffeine or alcoholAll foods you eat

Log each headache or migraine attack you experience, the time of day when it occurred, and what you did to resolve it. It’s also a good idea to track what the weather was like and any hormonal changes you’re aware of, such as when you ovulated or began your menstrual period. Write down your symptoms, says Strauss. “Where is the pain located? Are you tired or dizzy? Are you sensitive to light or sound? Do you have an upset stomach or vomiting? Keep track of those can help you understand your headaches,” she says. After a while, you should begin to see patterns. For instance, do you notice headaches more on weekends when you sleep in? What happens on Mondays, when you have to get to work early? What happens on Friday nights when you drink wine? This information will help doctors determine what’s causing your headaches, and what you can do to prevent them. “Every day of the week gives us hints,” says Green.

2. Take Acute, or Rescue, Medications as Soon as You Feel an Attack Starting

For people with mild to moderate migraine, over-the-counter medications such as acetaminophen (Tylenol), ibuprofen (Motrin), or naproxen (Aleve) may relieve migraine symptoms, according to the American Migraine Foundation. Prescription drugs called triptans are often used for moderate to severe migraine attacks. These medications work in a variety of ways in the brain to help relieve pain and restore function, and they’re more effective when used early in a migraine attack while the pain is still mild, according to the National Headache Foundation. There’s a new class of migraine drugs that target a different neurotransmitter pathway than triptans do, called CGRP receptor antagonists, or gepants, for short. There are currently two approved medications in this class, Nurtec (rimegepant) and Ubrelvy (ubrogepant). Like triptans, these drugs should be taken early in a migraine attack for best results.

3. Consider Preventive Medications if You Have Frequent Migraine Attacks

Many of the medications that are used to help prevent migraine have been “borrowed” from other conditions, says Strauss. These include blood pressure medications, such as beta-blockers, and antidepressants, she adds. Although those drugs can be helpful, there are new medications specifically designed to target and prevent migraine, “which is exciting for some of our patients for whom other medications have failed,” she says. Aimovig (erenumab), Ajovy (fremanezumab), and Emgality (galcanezumab) are once-monthly drugs that people inject at home to help prevent migraine. You’ll need a prescription from your doctor for any of these. Magnesium supplements can also be taken daily as prevention, says Nada Hindiyeh, MD, a headache specialist and researcher at Stanford Health Care in Palo Alto, California. There is evidence to support using magnesium, though the mechanism of action, or the “why” behind how it improves migraine, is not totally clear, she says. “It could be stabilizing cells or decreasing hyperexcitability or neuronal firing, but that’s all theoretical at this point,” says Dr. Hindiyeh.

4. Stick to a Sleep Schedule

“I think one of the most effective tools for my migraine patients has been focusing on healthy habits, and sleep is a big part of that; that can be especially challenging right now with all the changes that the pandemic has brought into our lives,” says Strauss. Consistency is key, says Strauss. “I recommend going to bed and getting up at around the same time every day, even on weekends, and avoiding naps if possible,” she says. This can be difficult, because sometimes sleep is the only thing that can help people during a headache, says Strauss. “The issue is if you’re taking excessive naps during the day, that makes it harder to go to sleep at night. Try to limit daytime sleeping, and move all your sleep to the night, and keep the same bedtime,” she says.

5. Stay Hydrated by Drinking Plenty of Water Throughout the Day

Hydration is one of the other healthy habits where consistency can make a big difference in migraine prevention, says Strauss. “So often, people realize at the end of the day that they haven’t been hydrating well, and then they try to catch up by drinking a lot. That’s usually not enough to make up for what your body needs,” she says. Try having at least one full glass of fluid with each meal, Strauss suggests. “That’s three glasses, and then try to have a glass when you first wake up before you eat breakfast, and then one at night with any medications you might take,” she says.

6. Consume the Same Amount of Caffeine Every Day, or None at All

There are a few reasons people with migraine should be cautious about consuming caffeine, says Strauss, including its mild diuretic effect. “It makes you pee out water and fluid, so you may think you’re doing really well in hydration, but too much caffeine may be impacting that,” she says. In addition, people with migraine can be really sensitive to caffeine, and it can affect the quality of your sleep, says Strauss. “Not getting good-quality sleep can be a trigger for migraine.” It would be best if you could eliminate caffeine, but that’s not always possible or desirable for some people, says Strauss. “I would suggest trying to not have caffeine after breakfast time. That would be a good way to limit the effects it would have on sleep and also minimize the amount of caffeine that you’re having throughout the day,” she says.

7. Get Regular Aerobic Exercise, and Try HIIT

Exercise is one of the lifestyle modifications that can make a real difference, says Hindiyeh. “Regular aerobic exercise can work as a preventive medication all on its own, and there are also some studies to suggest that yoga and HIIT (high-intensity interval training) can be helpful as well,” she says. A study published in March 2018 in Scandinavian Journal of Medicine & Science in Sports showed that high-intensity interval training was more effective at reducing the frequency of migraine attacks than moderate-intensity exercise, although moderate exercise also had a positive effect.

8. Follow a Migraine-Preventive Meal Schedule

One way to think about migraine is that it’s like your body’s “alarm,” and it can be set off by any type of change, says Strauss. If you skip meals, that can trigger the alarm, she says. “There’s a reason why many people say that breakfast is the most important meal of the day. If you have dinner, and then you skip breakfast because you’re busy, that means your brain hasn’t gotten any fuel in a long time,” says Strauss. It’s a good practice for people with headaches or migraine to have breakfast, lunch, and dinner with some snacks throughout the day, she adds. When it comes to which foods to avoid, that can vary from person to person, says Strauss. “Currently, we don’t have a lot of literature to support what some of our headache patients report to us. For example, I’m not convinced that chocolate is something that people with headaches really need to avoid,” she says. “Moderation is a good idea: Don’t eat or drink anything to excess. Avoid things with a lot of heavy preservatives in them, such as processed meats or hard cheeses,” says Strauss.

9. Make Sure Your Home and Workspace Aren’t Triggering Migraine Attacks

“We are seeing a lot of new patients who are experiencing headache for the first time because of changes that COVID-19 has caused,” says Strauss. In addition to managing extra stress, many people are now working remotely from their home in a less-than-ideal, makeshift office setup. Often, people set up their workspaces thinking this was going to be temporary, but the pandemic has gone on for a year now and may continue for a while, she says. “It’s a good idea to assess your situation, including where and how you sit most of the day,” says Strauss. If your job requires a lot of screen time, take periodic breaks. “You also might look at reducing the brightness of your screen or switch your computer settings so that the background is black and the text is white,” says Strauss. Additional reporting by Diana Rodriguez.