Coffee Data Science

Head Space for Espresso

Plus a Metal Screen

Robert McKeon Aloe
6 min readNov 30, 2021

In the beginning, I learned about the concept ofhead space, but I didn’t know the word. Head space is the gap between the top of the coffee grounds and the shower screen for espresso.

I wanted to explore head space better, but there is a trouble with the variable being tied to dose and grind, so it is harder to isolate than other variables. However, I figured I could collect some visual data to help frame the discussion with the ultimate aim of helping someone find the right amount of head space for their taste. The key in any espresso variable is determining what works for you, and often, the only way to achieve the best results is to fuck around and find out.

I learned about this through trial and error while using a Mr. Coffee espresso machine at work. It wasn’t a great machine. During coffee time, two friends and I would try to work some magic. We got better beans and a better grinder, but that didn’t solve all the problems. But we figured out a trick: if you overpack the basket almost to the point where the portafilter could not lock-in, the espresso could get an amazing mouthfeel.

Exploring the Space in the Head

For starting parameters, I used a Niche Setting 12 to grind, a Kim Express lever machine for the shot, and I had a 30 second pre-infusion for each shot. I look at 20g, 22g, and 24g for a 20g VST basket. All these shots also had a metal filter on top to reduce the transient effect of the water slamming into the top of the puck.

In these pictures, each row is 5 seconds in time. Lever machines are prone to donuts, and that behavior is tied to temperature, pressure, dose, and tamp. In these experiments, I pulled the shots at the same time, and I applied the same tamp pressure.


In the case of 20g, there was an extreme channel on the left side that I tried to use a cup to separate from the rest. This was due to a slight mistake when I knocked the portafilter against the machine.

Either way, 20g and 24g had more of a donut than 22g. 24g took the longest to cover the filter, and that’s a matter of how much coffee the water has to go through.

We can look also look at the top and the bottom of the pucks after the shot to see how they went.


For 20g on the bottom, there are a lot of dark spots on one side and in the middle, which indicate slow flow. This is worse for 24g indicating more channeling. While 22g has dark spots on the outer ring, the center is more homogenous.

We can take a closer look at 20g from the top where the crack and the holes show the cause of the extreme channeling from the top.

A closer look at 22g shows less issues on the sides.

The key part of the 24g shot was the amount of room after the shot because of how much the coffee swelled.

Left: Pre-shot, Right: Post Shot

The main takeaway from this piece should that you should experiment with headspace. As someone in a forum has said, the dose for the basket is a recommended starting point. Dose, tamping pressure, and headspace are tied together, and these variables should be experimented with to help you find the best combination for your machine and your coffee.



Robert McKeon Aloe

I’m in love with my Wife, my Kids, Espresso, Data Science, tomatoes, cooking, engineering, talking, family, Paris, and Italy, not necessarily in that order.