I’ll never know how much caffeine I consumed the night I practically drank my weight in Typhoo tea, but given the fact that I stayed awake for 24 hours, it was an awful lot. The tea was delicious, the conversation with friends was engaging—and both conspired to see me consuming three pots of the stuff before I realized what I had done. Jitteriness followed; then a headache; then accelerated heart rate; and finally a full day and night of sleeplessness.
That may have been my lowest caffeine moment, but it was not remotely the only time I overindulged. Like most adults, I consume caffeine on a daily basis, and I’ve sometimes paid a price—especially in terms of insomnia. So how much caffeine is too much? How do you quit if you want to? And what is the best time of day to stop drinking it if you don’t want to spend the night staring at the ceiling? Here’s what you need to know.
How does caffeine have its effects?
In the brain, caffeine blocks or impedes the effect of adenosine, a building block of nucleic acid found in all of the cells in the body. Ordinarily, adenosine is a central nervous system depressant that promotes sleep and suppresses arousal. Caffeine starts interfering with adenosine relatively quickly; it is absorbed by the small intestine and has its peak effect within 30 minutes or so, depending on multiple factors including how much food is in your stomach.
What drinks contain caffeine?
The place most people find their caffeine is in their coffee cups, and there can be an awful lot of it there. The U.S. Food and Drug Administration recommends limiting your caffeine intake to 400 mg or less per day. A single 8-oz. cup of coffee contains about 100 mg, and with coffee shops like Starbucks selling single servings of up to 20 oz., it’s easy to break through that limit—especially if you begin consuming coffee early in the day.
Read More: 8 Ways to Stay Hydrated if You Hate Drinking Water
Tea, of course, contains caffeine too. An 8-oz. cup of black tea has just shy of 50 mg, and green tea weighs in at close to 30. Cola has 22 mg in an 8-oz. serving, and while that is much less than coffee, soft drinks are typically served in 12-oz. cans or 20-oz. bottles, so here, too, the caffeine can add up.
As for energy drinks, beware. A small, 8.4-oz. can of Red Bull contains 80 mg of caffeine, and a concentrated, 2-oz. energy shot can contain a staggering 215 mg, according to the Mayo Clinic. Just how any one person will react to these caffeine dosings can be hard to predict, and the 400-mg limit is just a general benchmark.
“There is individual variation in how caffeine is metabolized,” says registered dietitian nutritionist Maya Feller, “so some people may experience unwanted side effects with a lower amount of caffeine.”
What are caffeine's side effects?
Since caffeine is a stimulant, it can make it harder both to fall and stay asleep. Other side effects can include irritability, nervousness, excessive urination, headaches, and muscle tremors, says registered dietitian Mindy Haar, assistant dean at the New York Institute of Technology’s School of Health Professions. “For people with a history of anxiety, depression, or mood disorders,” Feller says, “high caffeine intake can exacerbate feelings of instability.”
You can even have caffeine withdrawal. Symptoms can be similar to those of withdrawal from other mood-altering substances, including headaches, fatigue or drowsiness, depressed mood, irritability, poor concentration, nausea, vomiting, or muscle pain and stiffness.
So how do you safely quit caffeine?
For most people, caffeine is not harmful and may even have health benefits. According to the American Heart Association, regular coffee drinkers may be less likely to develop cancer and several other chronic diseases. Caffeine may also reduce appetite and lower depression risk. But that’s mostly true of people who consume caffeine in moderation. Others may suffer from jitteriness, insomnia, and coffee’s other unpleasant side effects. For them, abstinence—or at least cutting back—may be best.
Read More: The 1 Heart-Health Habit You Should Start When You’re Young
Quitting caffeine is best done the same way you’d quit any other drug: gradually. “I do not recommend going cold turkey,” says Feller, “especially for someone who regularly consumes caffeine.” Start reducing your intake by 5% to 10% each day while drinking your caffeine earlier in the day. “Maintain this for 3-4 days, and then remove the second drink until all caffeine is consumed before noon,” and you’ve capped your daily intake at 400 mg. Continue this slow detox until your desired level.
Cutting out caffeinated beverages does have a downside. It can mean reducing the overall amount of fluids you consume in a day, and that can be bad for your health. According to the Mayo Clinic, men should drink about 15.5 cups, or 3.7 liters of fluids per day, and women should consume 11.5 cups, or 2.7 liters. Haar thus recommends replacing each caffeinated drink you eliminate with water or a decaf beverage.
What time should you stop drinking caffeine during the day?
Feller recommends that people keeping a 9 a.m. to 5 p.m. workday schedule limit their caffeine intake to the hours before noon. If you work an irregular or overnight shift, similarly stop drinking caffeine 10 or 11 hours before you go to bed. The Sleep Foundation gives you a little more wiggle room, suggesting stopping caffeine at least eight hours before bed. But again, there are person-to-person variations.
“Aside from general differences in metabolism between people,” says Haar, “obesity, smoking, use of oral contraceptives, altitude, and pregnancy can affect how long it takes for caffeine to be totally out of your system. You should observe your own intake and how easy it is to fall asleep.”
More Must-Reads from TIME
- Donald Trump Is TIME's 2024 Person of the Year
- Why We Chose Trump as Person of the Year
- Is Intermittent Fasting Good or Bad for You?
- The 100 Must-Read Books of 2024
- The 20 Best Christmas TV Episodes
- Column: If Optimism Feels Ridiculous Now, Try Hope
- The Future of Climate Action Is Trade Policy
- Merle Bombardieri Is Helping People Make the Baby Decision
Write to Jeffrey Kluger at jeffrey.kluger@time.com