Coffee is one of the most popular sources of caffeine in the American diet, and according to the National Coffee Association, 62 percent of Americans drink coffee every day, with the average coffee drinker consuming just over three cups per day. Although it’s easy to become dependent on caffeine, such that stopping it abruptly causes withdrawal symptoms such as headache, it’s generally considered safe for most people in reasonable quantities. The U.S. Food and Drug Administration (FDA) notes that consuming up to 400 milligrams (mg) a day is generally safe for healthy adults. For reference, an average 8-ounce cup of coffee has about 80 to 100 mg, and a cola-type soda contains about 30 to 40 mg. For people with migraine or headaches, the relationship between caffeine and their head pain is a delicate one. On the one hand, caffeine may help ease headaches; on the other, if you are trying to give up or cut down on caffeine, you may experience a temporary spate of caffeine withdrawal headaches. RELATED: 10 Things You Need to Know About Caffeine

Caffeine as a Headache Treatment

Caffeine seems to be an effective acute treatment for migraine, or at least a component for the acute treatment of migraine from a patient perspective, says Roderick Spears, MD, a neurologist and headache specialist at Penn Medicine in Philadelphia. “Patients often report that if they can have a caffeinated beverage combined with a medication, it’s usually helpful during an attack,” Dr. Spears says. There are also medications to treat headache and migraine — both over-the-counter and prescription — that contain caffeine and can be helpful for some patients when they are having a migraine attack, says Spears. All formulations of the over-the-counter drug Excedrin (with the exception of Excedrin PM), for example, contain 65 mg of caffeine per tablet, along with acetaminophen and aspirin. Similarly the drug Cafergot, available by prescription, contains ergotamine and caffeine. Each tablet contains 100 mg of caffeine, and the recommended dose is to take two tablets as soon as you notice a migraine attack starting and one additional tablet every 30 minutes — up to a total of six tablets per 24 hours — if symptoms continue. The mechanism of action behind caffeine’s pain-relieving potential is related to the blood vessels, says Spears. “We know that blood vessels dilate with migraine, and caffeine is thought to be beneficial because it causes vasoconstriction. That’s what people are addressing when they consume a caffeinated beverage or a medication that contains caffeine when they have a migraine,” he says.

Caffeine Headache as a Withdrawal Symptom

On the flipside, if you’ve ever tried to cut back on caffeine, you know that headaches can occur as a result. And it doesn’t matter what foods or drinks the caffeine comes from — the issue is whether you have a regular habit of consuming about the same amount of caffeine every day. If you suddenly get a lot less caffeine, you’ll likely have a headache. Caffeine withdrawal isn’t just something that happens to people who drink a lot of coffee or caffeinated beverages; it can happen to people to drink as little as one small cup of coffee per day, according to StatPearls. The incidence of headache as a result of caffeine withdrawal can be as high as 50 percent — and that’s in the general population, not just in people who have migraine.

If your headache occurs a few hours after you last consumed caffeine or missed your normal cup of coffee or energy drink, that could be a sign that it’s related to a caffeine deficit, says Spears. “Typically, the mid-to-late morning is a common time for a caffeine withdrawal headache, because a lot of people with start their day with coffee or something like that,” he says. A caffeine withdrawal headache can feel different from a migraine attack, he says. “The headache has a mild to moderate profile, and it tends to not have the migraine-like features,” says Spears. RELATED: Migraine Signs and Symptoms

Caffeine Can Contribute to Medication-Overuse Headache

The International Headache Society defines medication-overuse headache (MOH) as a headache occurring on 15 or more days per month in a person with a preexisting primary headache disorder, such as migraine, and developing as a consequence of regular overuse of acute or symptomatic headache medication for more than three months. There are several medications linked with MOH, including combination pain relievers that contain aspirin and caffeine. However, it’s not only medications with caffeine that are associated with this type of headache: Caffeine intake at levels of 100 to 200 mg per day is probably enough to contribute to medication overuse headache, says Stewart Tepper, MD, professor of neurology at the Dartmouth Geisel School of Medicine in Hanover, New Hampshire. RELATED: 10 Things You Need to Know About Medication-Overuse Headache

Caffeine as a Risk Factor for Chronic Migraine

There’s evidence that too much caffeine consumption is a risk factor for developing chronic migraine, says Spears. Chronic migraine is when a person experiences 15 or more days per month of headache with migrainous features, according to the Migraine Research Foundation. It’s estimated that chronic migraine affects about 1 to 2 percent of the general population and close to 8 percent of people with migraine. Each year approximately 3 percent of people with episodic migraine “convert” to having chronic migraine each year, according to a paper published in 2016 in the Nature Reviews Neurology. RELATED: Expert Advice on Managing Chronic Migraine

Tracking Headaches and Caffeine Consumption Can Help

“If I have patients with chronic migraine or chronic headaches, I usually recommend that they track their headaches and then try to do some type of step down as far as caffeine use,” says Spears. This doesn’t mean going “cold turkey,” he adds. “That would most likely send them into a severe headache situation. I recommended maybe decreasing caffeine on one or two days every week to see if it makes a difference,” he says. “If the patient is in the episodic migraine category — less than 15 days per month — then I recommend keeping track of how they use caffeine, and how it relates to their migraine attacks,” he says. Paying attention to whether it seems to ward off or shorten an attack versus whether it seems to trigger migraine can help determine whether reducing or eliminating caffeine is the best way to proceed, Spears explains.

Tips for Reducing or Eliminating Caffeine

If you decide that cutting down or quitting caffeine is the way to go, start slowly. If you like caffeine in the form of cold beverages such as sodas or energy drinks, the Cleveland Clinic suggests trying to drink water instead. Caffeine-free unsweetened iced tea might also be a satisfying substitute. If you’re a coffee drinker, try cutting out one cup of caffeinated coffee a day, or drink a half-caffeinated and half-decaffeinated coffee mix. Slowly shifting to higher ratio of decaf over a period of weeks can help reduce your intake while minimizing withdrawal symptoms. But keep in mind that decaffeinated coffee still contains a small amount of caffeine, which can keep you dependent on caffeine and lead to withdrawal headache if you stop the decaf abruptly. Another idea for reducing caffeine intake: Exercise instead. “I’ve seen people substitute exercise at that time when they would typically have coffee, and that seems to help them through the withdrawal process,” says Spears. Additional reporting by Madeline R. Vann, MPH.