After years of debating whether coffee is bad for us, the argument has made a dramatic U-turn: Is coffee good for us?

The answer is yes. In moderation, coffee seems to be good for most people — that's three to five daily cups, or up to 400 milligrams of caffeine.

"The evidence is pretty consistent that coffee is associated with a lower risk of mortality," said Erikka Loftfield, a research fellow at the National Cancer Institute.

For years, coffee was believed to be a possible carcinogen. But in 2015, research that controlled for lifestyle factors, like how many heavy coffee drinkers also smoked, refuted that premise.

Since then, the swing has gone even further. A large 2017 review on coffee consumption and human health in the British Medical Journal found that moderate coffee drinkers had less cardiovascular disease and premature death from all causes.

Now experts say some of the strongest protective effects may be with Type 2 diabetes, Parkinson's disease and liver conditions such as cirrhosis, liver cancer and chronic liver disease. Having about five cups of coffee a day, instead of none, is correlated with a 30% decreased risk of Type 2 diabetes, according to a meta-analysis of 30 studies.

The potential benefit from coffee might be from the polyphenols, which are plant compounds that have antioxidant properties, according to Dr. Giuseppe Grosso, an assistant professor in human nutrition at the University of Catania in Italy and lead author of an umbrella review in the Annual Review of Nutrition.

The study comes with an asterisk: There are concerns about overconsumption, particularly for pregnant women. Cutting down coffee might help with gastroesophageal reflux, too.

Next up for researchers is figuring out if the type of coffee matters. Dark or light roast? Coarse grind or fine? Arabica or robusta?

"All of these different aspects affect the taste but also affect the compounds within the coffees," said Neal Freedman, a senior investigator with the National Cancer Institute. "But it's not clear at all how these different levels of compounds may be related to health."

The way you prepare your cup of joe might influence your cholesterol levels, too.

"The one coffee we know not suitable to be drinking is the boiled coffee," said Marilyn Cornelis, an assistant professor in preventive medicine at Northwestern University's Feinberg School of Medicine. The oil in boiled coffee has cafestol and kahweol, compounds called diterpenes. They are shown to raise LDL, the bad cholesterol, and slightly lower HDL, what's known as the good kind.

Researchers have yet to determine whether adding milk or sugar cancels out benefits. A 2015 study found that a small amount — a tablespoon of cream or milk or a teaspoon of sugar — did not have an impact. But no studies have been done on drinks with larger amounts, such as lattés or dessert-like beverages like Dunkin's creamy frozen coconut caramel coffee.