It’s all in the grind, say mathematicians who turned to equations to solve mystery

What’s the secret of the perfect espresso? It’s a question that has long troubled cafe owners around the world, but now mathematicians say they have worked out the formula for achieving the perfect brew – and it all comes down to the daily grind.

“There is a common experience, particularly for people making coffee in their homes, and baristas as well, that you brew two espressos one after the other, you use the same ground coffee and seemingly you brew it in exactly the same way, yet the two shots can taste quite different to one another,” said Dr Jamie Foster at Portsmouth University, a co-author of the research.

But by using coffee that is ground coarser than usual, Foster and colleagues say there is less variation from cup to cup – a switch that also brings other benefits: it is faster, cheaper, and produces less waste.

Writing in the journal Matter, Foster and colleagues report how they set out to explore how to optimise coffee making by developing mathematical equations to model the processes occurring in the bed of coffee as water is forced through when making an espresso.

The team found that for a given water temperature and pressure, the model suggested that the finer the grind, the greater the proportion of coffee that ends up dissolved in the water.

Foster said, intuitively that made sense: “If the little chunks making up the bed of coffee are smaller then there is more surface area for the water to come into contact with.”

That would mean to reduce waste and produce the most efficient coffee, cafes should grind their coffee as fine as possible.

However when the team carried out tests with a coffee machine in a real cafe, they found that at very fine grinds the model broke down beyond a certain point..

“The particles get so small that they actually clog up bits of the bed [of ground coffee],” said Foster, which means the area becomes impenetrable to water.

The team says that leads to differences in the extraction yield from different areas of the coffee bed, and variation from cup to cup as different sized parts of the bed can clog up each time. That variability is reflected in the flavour: a higher “extraction yield” is typically more bitter, while lower makes for a more sour cup.

“The key to making the shot reproducible is you want the particles just large enough that the flow is uniform and predictable, but as small as they can be to maximise the surface area,” said Foster.

Crucially, he added, cafes typically use coffee that is ground too finely, meaning the taste is unpredictable.

Foster and colleagues add that by grinding slightly more coarsely, the barista can subsequently lower the mass of coffee used for each shot – or the amount of water passing through it – to get the desired taste more consistently and at lower cost.

“We reckon you can save about 25% coffee mass per shot if you use this kind of efficient recipe with the slightly coarser coffee,” he said, adding that the team trialled their approach in a coffee shop in Oregon for a year and found it not only boosted revenues but reduced the time it took to produce a shot. “They save several thousands of dollars over the year,” said Foster.

But while there appears to be a sweet spot for grinding, quite what that is can vary – something Foster said means coffee-making remains something of an art.

“A barista chooses the temperature and the pressure and the beans to make it taste the way they like, and then you make the extraction reproducible and efficient by fiddling with the grind setting,” he said.