Melatonin is the hormone that tells your body it is night, and caffeine is the world’s most common stimulant, so the two seem built to pull against each other. The interaction isn’t a simple tug of war, though. Caffeine affects the melatonin you make and the melatonin you swallow in opposite ways. Evening coffee can quiet and push back your own melatonin while making a supplement hit harder than its label suggests.
How Caffeine Lowers and Delays Your Own Melatonin
Caffeinated coffee in the evening lowers the amount of melatonin your body releases through the following night.1PubMed. The effects of coffee consumption on sleep and melatonin secretion In people kept awake overnight in dim light, 200 mg of caffeine twice a night, about four cups of coffee, suppressed nighttime melatonin.2Brain Research. Caffeine and light effects on nighttime melatonin and temperature levels in sleep-deprived humans It also blunted the normal overnight drop in body temperature that helps you fall and stay asleep.2Brain Research. Caffeine and light effects on nighttime melatonin and temperature levels in sleep-deprived humans So caffeine affects sleep through your hormone signals, not only by making you feel alert.
Caffeine also moves your body clock later. Your body clock is the internal timer that decides when melatonin rises each evening. About 200 mg of caffeine, roughly a double espresso, taken 3 hours before bed pushed melatonin’s evening rise about 40 minutes later.3PubMed Central. Effects of caffeine on the human circadian clock in vivo and in vitro4PubMed Central. Exploring the Impact and Mechanisms of Coffee and Its Active Ingredients on Depression, Anxiety, and Sleep Disorders That delay was about half as large as the one caused by bright evening light.3PubMed Central. Effects of caffeine on the human circadian clock in vivo and in vitro Caffeine and bright light together delayed the clock even more, about 105 minutes.3PubMed Central. Effects of caffeine on the human circadian clock in vivo and in vitro The likely reason is that caffeine blocks adenosine, the brain chemical that builds sleep pressure, and adenosine also talks to the body clock.5PubMed Central. Sleep-Wake Regulation and Its Impact on Working Memory Performance: The Role of Adenosine
Those two jobs are separate. Blocking adenosine makes you feel awake right now, while the shifted timing signal tells your body when night begins. The alert feeling fades as the caffeine is cleared, but the later timing can remain into the night.
That is why judging by how fast you fall asleep misses the effect. Many people doze off after an evening coffee and assume it did nothing, yet their melatonin can still be lower and later. The cost tends to appear as lighter sleep or a groggy morning.
A 40-minute shift sounds small, but it adds up. You feel less sleepy at your usual bedtime even after the caffeine has worn off, and if the alarm stays put, sleep gets shorter.
Why Caffeine Makes Melatonin Pills Stronger
The liver clears both caffeine and melatonin mainly with one enzyme, CYP1A2, which you may see named on drug-interaction lists. When caffeine is in your system, the two compete and melatonin is cleared more slowly.6PubMed Central. Effects of caffeine intake on the pharmacokinetics of melatonin, a probe drug for CYP1A2 activity7PubMed. Caffeine raises the serum melatonin level in healthy subjects: an indication of melatonin metabolism by cytochrome P450(CYP)1A2 In one study, a melatonin pill taken with caffeine reached peak blood levels about 2.4 times higher and stayed in the blood about twice as long overall.6PubMed Central. Effects of caffeine intake on the pharmacokinetics of melatonin, a probe drug for CYP1A2 activity
Your own melatonin lingers too. Caffeine equal to two ordinary cups of coffee in the evening left about a third more of the body’s own melatonin circulating overnight.7PubMed. Caffeine raises the serum melatonin level in healthy subjects: an indication of melatonin metabolism by cytochrome P450(CYP)1A2 That doesn’t undo caffeine’s alerting and clock-delaying effects: the liver slows melatonin’s breakdown, while in the brain caffeine is still blocking sleep pressure.
The boost to supplement levels was larger in nonsmokers and in people with a common gene version that makes this enzyme very active.6PubMed Central. Effects of caffeine intake on the pharmacokinetics of melatonin, a probe drug for CYP1A2 activity Smoking speeds up the enzyme, so smokers break melatonin down faster to begin with. When someone quits, the enzyme slows, and both caffeine and melatonin last longer than before.
Timing decides how much this matters. The interaction depends on caffeine actually being in your body while the pill is absorbed and cleared, so a morning coffee has largely worn off by a bedtime dose. An evening coffee or an afternoon energy drink within several hours of the pill is where competition for the enzyme is most likely.
In practice, a 3 mg pill may act more like a larger dose. The extra can show up the next morning as grogginess, a heavy head, or feeling slow to get going. People who drink coffee daily may need less melatonin than they think, so starting with the lowest dose on the shelf is sensible.
Is It Safe to Take Melatonin If You Drink Coffee
Daytime coffee and bedtime melatonin are a common combination with no known serious harm for healthy adults. The catch is that caffeine lasts about 5 hours on average in adults, so an afternoon cup is still partly active at bedtime. Avoid caffeine for at least 6 hours before you plan to take melatonin and sleep. If you take other drugs cleared by the same liver enzyme, ask a pharmacist before adding either.
To find your cutoff, pick the time you plan to take melatonin and go to sleep, then subtract six hours. For an 11 p.m. bedtime, that means no caffeinated drinks after about 5 p.m., and an earlier bedtime moves the cutoff earlier. Six hours is a general guide and people clear caffeine at different speeds, so move the cutoff earlier if you still sleep poorly.
Caffeine hides in more places than coffee. Tea, cola, energy drinks and dark chocolate all contain it, some pain relievers and pre-workout powders contain a lot, and even decaf has a small amount. If your sleep stays poor despite no evening coffee, check labels.
Many people drink extra coffee to shake off a melatonin hangover. That caffeine can then delay the next night’s melatonin, which starts a cycle of more pills and more coffee. Lowering the melatonin dose is the better fix.
Teens and Body Weight Change the Effect
In teenage boys given caffeine, the delay in melatonin’s evening rise was not seen across the whole group.8PubMed. Wide awake at bedtime? Effects of caffeine on sleep and circadian timing in male adolescents – A randomized crossover trial It did appear in those whose dose was more than about 1.3 mg per kilogram of body weight, about 90 mg for a 70 kg person.8PubMed. Wide awake at bedtime? Effects of caffeine on sleep and circadian timing in male adolescents – A randomized crossover trial Some teens’ clocks shifted earlier instead, and the higher the dose for their size, the more likely a delay.9bioRxiv. Wide awake at bedtime? The effects of caffeine on sleep and circadian timing in teenagers – a randomized crossover trial Body size matters because the same amount of caffeine spreads through a smaller body at a higher concentration.
To estimate a teen’s personal threshold, multiply body weight in kilograms by 1.3. A 50 kg teen reaches it at about 65 mg, less than one standard coffee. Many energy drinks contain 80 to 160 mg, and afternoon sports drinks or sodas add up.
Using Caffeine and Melatonin for Night Shifts and Jet Lag
Using the two on purpose is a common strategy. For night shifts, 200 to 450 mg of caffeine in the first 2 hours of the shift can boost alertness without disturbing later daytime sleep.10Elsevier Inc.. Using Bright Light and Melatonin to Adjust to Night Work Avoid caffeine in the second half of a night shift, since it’s still active when you get into bed and can make daytime sleep shorter and lighter. If you feel drowsy late in the shift, a short break, light, or movement is a better choice than another coffee. Melatonin before daytime sleep is often paired with this approach to help shift the body clock.10Elsevier Inc.. Using Bright Light and Melatonin to Adjust to Night Work
A dark bedroom and avoiding bright light on the way home help melatonin work. Because daily coffee can strengthen a pill’s effect, a shift worker who drinks coffee at work may need only a low dose.
Eastward travel follows similar logic. Caffeine helps with daytime sleepiness on arrival, and melatonin helps sleep at the new bedtime. Keep caffeine to the morning at the destination, and don’t take both close together at night.
In athletes, caffeine before exercise improved performance on a sprint test whether or not melatonin had been taken the night before.11PubMed Central. Melatonin, Caffeine, or Their Combination: Effects on Sleep, Performance, Perceived Exertion in a Placebo-Controlled Crossover Study The melatonin-plus-caffeine combination also lowered markers of muscle damage and inflammation more than either alone.11PubMed Central. Melatonin, Caffeine, or Their Combination: Effects on Sleep, Performance, Perceived Exertion in a Placebo-Controlled Crossover Study
Long-Term Coffee Habits and Sleep Later in Life
Melatonin is made by the pineal gland, a small gland deep in the brain. A cup-year combines how much coffee someone drinks with how long they have drunk it, so one cup a day for a year is one cup-year. Older adults who drank more than 60 cup-years of coffee, such as two cups a day for 30 years, had about 20% smaller pineal glands.12Oxford Academic (Sleep). Lifetime coffee consumption, pineal gland volume, and sleep quality in late life The smaller gland helped explain their poorer sleep quality and efficiency.12Oxford Academic (Sleep). Lifetime coffee consumption, pineal gland volume, and sleep quality in late life This shows a link, not proof that coffee shrank the gland.
Melatonin naturally declines with age anyway. Moving coffee earlier in the day is a low-cost change, and cutting back slowly avoids withdrawal headaches. Persistent poor sleep is worth discussing with a doctor.

