By Jill Waldbieser

How late can you drink coffee and still get a good night's sleep?

It's been widely reported that a coffee habit can net you a range of health benefits, including a longer lifespan. Credit the brew's rich concentration of polyphenols, plant-based compounds that fight off free radicals, or molecules that contribute to age- and disease-related cellular damage.

Photo: Rekha Garton/Getty Images

But for all the reported benefits, one area where java drinkers can suffer — particularly if they're drinking the four to six cups daily that researchers found would yield optimal benefits — is getting enough shut-eye.

"A lot of times, insomnia is driven by caffeinated coffee drinks, even if you're consuming them early in the day," says Bob Arnot, PhD, author of The Coffee Lover's Bible. So timing that last cup of joe can be crucial.

Studies on how your morning buzz affects your evening zzz's have been conflicted, however. A recent study in the journal Sleep found that, unlike alcohol and nicotine, drinking caffeinated beverages before bed had no impact on how well study subjects slept. Previous research found the opposite, that consuming caffeine even six hours before bed could disrupt your rest.

The reason for these discrepancies, explains Dr. Arnot, is that not everyone metabolizes caffeine at the same rate. In 2016, University of Toronto researchers identified a genetic variation that determines whether an individual processes the drug quickly or slowly. "Roughly half the population are slow processors," says Dr. Arnot, and today, even services like 23andMe can identify which you are, if it isn't obvious to you.

Slow processors take up to four times as long as the rest of the population to rid their systems of caffeine, and it can impact more than just their sleep. While people who can metabolize caffeine fairly quickly enjoy the protective effects of a good arabica, their slow processor counterparts are more likely to have high blood pressure and increased risk of cardiac disease, even if they stay within the FDA's recommended 400 milligram per day caffeine limit (about four cups of coffee).

All this is to say, your ideal time to turn off the automatic drip depends on how well your genes handle caffeine and your usual bedtime. As a general rule, Dr. Arnot says between 1 and 2 p.m. is a good stopping point. But you don't need caffeine to reap coffee's other benefits. Decaf has all the polyphenols of caffeinated coffee, though some has trace amounts of caffeine, so those who are sensitive to its effects will still want to stop drinking it well before bedtime.

Each product we feature has been independently selected and reviewed by our editorial team. If you make a purchase using the links included, we may earn commission.

Related: This Is the Very Best Instant Coffee