When you have a late-night brew, your body gets really confused. 

By Samantha Zabell
Updated September 17, 2015
JGI/Jamie Grill/Getty Images

Everyone knows it's probably not a great idea to settle down with a mug of coffee at 10 p.m. if you have any hopes of falling to sleep soon after. But a new study from the University of Colorado Boulder sheds some light on how caffeine messes with sleep cycles—in a small study published in Science Translational Medicine, scientists found that caffeine keeps you awake because it's messing with your internal clock.

Our circadian rhythm helps our bodies to know when to fall asleep and when to rise and shine. The research team recruited five subjects to take part in a 49-day study, where they were tested under four separate conditions that compared caffeine's effect on sleep to light's effect on sleep (bright light has been shown to disrupt circadian rhythms). They were tested with low light and a placebo pill; bright light and a placebo pill; low light and a caffeine pill; and bright light and a caffeine pill. Researchers periodically tested saliva from each participant to study levels of melatonin, the "sleep hormone," since this hormone also helps regulate the internal clock.

Bright light alone delayed the internal clock by 85 minutes, and the combination of bright light and a caffeine pill delayed the clock by 105 minutes. But researchers also found that the amount of caffeine found in a double espresso can cause a 40-minute "phase delay" in our internal clock. While every roast and brew has a slightly different caffeine content, a double espresso can, in fact, have as much caffeine as one cup of coffee. The researchers also noticed that certain cells in the body, part of our "clock genes," were also altered by caffeine—it actually blocked the cell receptors that normally help people fall asleep.

When our circadian rhythms change, "this says that everything that is timed by this circadian clock such as sleep timing, the release of hormones, when we're performing at our best, or when we're most sleepy, are also changing," lead author Ken Wright said in a statement. Wright explains the study has specific implications for night owls, since they often drink coffee late at night, and so go to bed later and wake up later.

"It could be that one of the reasons they're night owls is because they're drinking caffeine," says Wright.

There is one possible advantage: Scientists wonder if they can use the properties of caffeine to treat jet-lagged travelers who have trouble adjusting after international flights.