Scientists have uncovered the surprising secret behind the perfect cup of coffee - reasonably hard tap water.
Experts used computational chemistry methods to examine the impact of different compositions of water on the flavour of coffee.
They found water composition made a "dramatic difference" to coffee from the same bean - with certain types of hardness boosting the taste.
High magnesium ion levels were found to increase the extraction of coffee into water, though high bicarbonate levels were bad for flavour.
Sodium rich water - such as that produced by water softeners - was also not beneficial to taste, according to chemist Christopher Hendon of the University of Bath.
Mr Hendon embarked on the project with his friend, local coffee shop owner Maxwell Colonna-Dashwood, who was crowned the UK's Barista Champion in April.
The pair - armed with their new coffee chemistry knowledge - are now heading to represent the UK in the World Barista Championships in Rimini, Italy.
"Coffee beans contain hundreds of chemicals; the precise composition depends on the type of bean and how it is roasted," Mr Hendon, a PhD student at the university's Centre for Sustainable Chemical Technologies, said.
"The flavour of the resulting coffee is determined by how much of these chemicals are extracted by the water, which is influenced by roast profile, grind, temperature, pressure and brew time.
"We've found that the water composition is key to the proportions of sugars, starches, bases and acids extracted from a particular roast."
Mr Hendon used computational chemistry methods in the study, published in the Journal of Agricultural Food Chemistry.
These methods were used to examine how different compositions of water affect the extraction of six chemicals that contribute to the flavour of coffee, along with caffeine.
The coffee industry currently uses guidelines on the ideal water for coffeeextraction from the Speciality Coffee Association of Europe (SCAE), which puts emphasis on measuring ionic conductivity to quantify the total dissolved solids.
However, the research found it was in fact the proportions of these ions that affected the extraction, and therefore the taste, of the coffee.
"Hard water is generally considered to be bad for coffee, but we found it was the type of hardness that mattered - while high bicarbonate levels are bad, high magnesium ion levels increase the extraction of coffee into water and improve the taste," Mr Hendon said.
"There is no one particular perfect composition of water that produces consistently flavoursome extractions from all roasted coffee. But magnesium-rich water is better at extracting coffee compounds and the resultant flavour depends on the balance between both the ions in the water and the quantity of bicarbonate present."