A South Carolina coroner ruled this week that a high school student died after ingesting too much caffeine.

Richland (S.C) County Coroner Gary Watts said Davis Allen Cripe died from an irregular heartbeat that resulted in a “cardiac event.”

According to Watts, Cripe drank a large Diet Mountain Dew, a McDonald’s McCafé Latte and an energy drink in the span of about two hours on the morning he died. That combination, Watts said, was enough to lead to a “caffeine-induced cardiac event causing a probable arrhythmia,”

How can consuming too much caffeine lead to death? Here’s a look.

What is caffeine?

Caffeine is both a drug and a food additive, according to the Food and Drug Administration. It belongs to a group of medicines called CNS (central nervous system) stimulants. Caffeine is used in over-the-counter and prescription medications.

Where does it come from?

Caffeine is a “naturally occurring substance found in the leaves, seeds or fruits of more than 60 plants," according to the International Food Information Council.

How much caffeine can I safely drink in a day?

While it varies by person, a good rule to follow is to drink no more than four cups of coffee a day. That’s about 400 milligrams of caffeine daily.

That is only part of the total amount of caffeine you could consume in a day. Caffeine is also in other beverages and food.

A 1997 study found that if you exceed 678 mg of caffeine a day, you increase the chance of cardiac arrest by 44 percent.

How do you know if you have consumed too much caffeine?

If you’ve had too much, you’ll start having palpitations, experience nervousness and anxiety, and you may feel dizzy due to elevated blood pressure. You can also develop a migraine headache, muscle tremors, have frequent urination and an upset stomach.

How much caffeine is in food and drinks?

  • Coffee, brewed - 102 -200 milligrams per cup
  • Coffee, instant - 27-173 milligrams per cup
  • Coffee, decaffeinated - 3-12 milligrams per cup
  • Tea, brewed - 40-120 milligrams per cup
  • Tea, instant - 28 milligrams per cup
  • Caffeine-containing cola and other soft drinks - 36-71 milligrams per 12 ounces
  • Cola and other soft drinks, decaffeinated - 0 milligrams per 12 ounces
  • Cocoa - 3 - 13 milligrams per cup
  • Chocolate, milk - 3-6 milligrams per ounce
  • Bittersweet chocolate - 25 milligrams per ounce