Many of us enjoy a cup of coffee or two throughout the day, but a new study suggests that too much of the stuff could shrink brain volume and increase the risk of dementia over the long term.

This was a large study as well, involving 17,702 participants aged from 37 to 73, taken from the UK Biobank project. The long-running project collects information on a host of different health and lifestyle metrics, including coffee consumption, brain volume, and disease – as well as additional data like socioeconomic status that scientists can factor in.

The excess coffee risks can jump quite sharply, though you do need to be drinking a lot of the beverage: The study found that people drinking six or more cups a day had a 53 percent higher chance of getting dementia than those who drank one or two cups or less.

"Coffee is among the most popular drinks in the world," says epidemiologist Kitty Pham from the University of South Australia. "Yet with global consumption being more than nine billion kilograms a year, it's critical that we understand any potential health implications."

"This is the most extensive investigation into the connections between coffee, brain volume measurements, the risks of dementia, and the risks of stroke – it's also the largest study to consider volumetric brain imaging data and a wide range of confounding factors."

While we know that coffee affects the brain in a variety of ways – including keeping us alert – previous research has been inconclusive and, in some cases, contradictory when it comes to any relationship between brain volume and dementia.

After allowing for variables like sex, age, BMI, and long-standing illnesses, the researchers found a relationship between drinking more coffee and smaller total brain volumes in participants, as well as the increased risk of dementia.

This study doesn't look at what brain shrinkage could lead to. While both gray matter and white matter help control motor and sensory function, it's difficult to link having any less of this matter to specific results in behavior or brain activity. Brain shrinkage is also something that tends to happen naturally as we get older, and some studies suggest that there may be a connection between volume and dementia.

"Accounting for all possible permutations, we consistently found that higher coffee consumption was significantly associated with reduced brain volume – essentially, drinking more than six cups of coffee a day may be putting you at risk of brain diseases such as dementia and stroke," says Pham.

What's not clear is why this happens: there's plenty more research to be done into how caffeine and coffee interact with brain cells, whether those interactions end up being positive or negative.

It's possible that the way caffeine binds to the adenosine receptors in the brain is one way these changes happen, though they could also be caused less directly through coffee's impact on other parts of the body (such as the cardiovascular system).

What we can say from this research is that a lot of coffee seems to be linked to a much higher risk of dementia in a large sample group – a link that's strong enough to perhaps reconsider how you're getting through the day.

"Typical daily coffee consumption is somewhere between one and two standard cups of coffee," says epidemiologist Elina Hyppönen from the University of South Australia. "Of course, while unit measures can vary, a couple of cups of coffee a day is generally fine."

"However, if you're finding that your coffee consumption is heading up toward more than six cups a day, it's about time you rethink your next drink."

The research has been published by Nutritional Neuroscience.