You’re a dozen exclamation points into an email when you realize that triple shot of espresso was maybe a mistake. Your hands shake as you wipe sweat off your face.

You’re officially buzzed—and not in a good way.

The good news is that mild caffeine over-indulgences (like an extra cup of coffee or two) are not dangerous, says Samantha Heller, R.D., a senior clinical nutritionist at the NYU Langone Medical Center. 

Still, feeling like your heart is thumping to a dubstep beat isn’t pleasant. 

Related: 6 Ways You Completely Ruin Everything Good About Coffee

Which brings us to the bad news: You’re going to be feeling like this for a while. 

“Four to six hours is the general rule of thumb for how long it takes caffeine to wear off,” says Heller. 

However, there’s a range in how people metabolize the stimulant. Your weight, genetics, and tolerance will determine how edgy you feel and for how long. Unfortunately, there’s not a ton you can do to speed up that process, says Heller. 

Related: Why Caffeine Won’t Do a Damn Thing After One Too Many Late Nights 

Adam Splaver, M.D., a South Florida cardiologist, suggests hydrating well to flush the caffeine out of your system. Exercise may also help, since it will torch excess energy while speeding up your metabolism.

If you start to feel yourself panicking, Heller recommends taking a deep breath and reminding yourself that the situation is chemically induced and temporary, since caffeine is a central nervous system stimulant. 

“It affects the body chemistry in ways that make us launch into fight or flight mode,” she says, so freaking out only makes the situation worse.

Want to make sure you never experience this horrible state of being again? 

Try these 7 Ways to Boost Your Energy Without Caffeine—and if you really can’t go without your cup of Joe, limit your caffeine intake to 400 milligrams a day, says Heller. Most brewed coffee has anywhere from 80 to 200 milligrams.

(For an amazing coffee with naturally bold flavors, check out The Better Man Blend from the Men’s Health store.)

“There’s a lot of variation depending on how it’s made and what type of coffee it is,” she explains.

Two or three cups is fine—four cups may even be safe if you have a high caffeine tolerance. Going over that, though, is asking for trouble.   

Related: How to Make the Best Coffee You’ll Ever Drink 

And if you start feeling nauseous, faint or dizzy, you may be tottering on the edge of a true overdose. While rare, overdoses can be serious, especially if you have a known heart condition or high blood pressure

“[An overdose] can cause heart rhythm disturbances, vasoconstriction, heart attack, stroke, and high blood pressure in certain populations,” says Splaver. 

If you think you’ve truly overdosed, you should head to the emergency room—just don’t blame your barista for over-serving you.