Yes, caffeine can cause headaches but the can also relieve them depending on the individual's level of consumption and patterns. Regular caffeine users who abruptly cut back or quit using it may suffer from withdrawal symptoms, such as headaches. Caffeine constricts blood vessels in the brain, which is why this occurs. Caffeine withdrawal may cause blood vessels to widen, increasing blood flow and causing headache pain.
Source: "Caffeine and Headaches: Is There a Link?" (2016), American Academy of Neurology. The American Academy of Neurology states that headaches are frequently caused by caffeine withdrawal, particularly in those who routinely take large amounts of the stimulant.
Headaches can result from consuming excessive amounts of caffeine (above 400 mg daily, or around four 8-ounce cups of brewed coffee). This is because caffeine's diuretic effects might cause dehydration or overstimulate the central nervous system. "Caffeine: How Much is Too Much?" from the Mayo Clinic (2020) is the source. According to the Mayo Clinic, consuming too much coffee can cause a number of problems, such as headaches and irritability. Additionally, it has been demonstrated that caffeine can help reduce migraines and other headache kinds. For this reason, caffeine is a common ingredient in over-the-counter migraine drugs. It may help relieve headaches because it narrows dilated blood vessels. Source: "Caffeine and Migraines" (2020) from the American Migraine Foundation. According to the foundation, coffee can lessen the intensity of migraines by constricting blood vessels and inhibiting specific pain-inducing brain chemicals.
A study done by UCLA states, "Caffeine is a mild stimulant that is easily absorbed by the body. Depending on each individual, its effects can last up to 12 hours. As caffeine revs up the central nervous system, it can leave you feeling more awake and alert, deliver a boost of energy and help with focus and even mood. Caffeine also narrows blood vessels that surround the brain. That is its link to headache. In some types of headaches, the blood vessels in the brain dilate, or swell. They expand into the surrounding tissues, which triggers pain. Consuming caffeine, which narrows the vessels, can ease or even reverse some headache pain. Ironically, a sudden lack of daily caffeine can cause a headache. It triggers a series of events that also lead to dilated blood vessels, and thus to headache pain."