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.

Loading article content

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.

Mr Hendon and Mr Colonna-Dashwood are now planning to write a book on the science behind making the perfect coffee.