/ baking

The science of cake

How does cake work?

For years I followed the instructions of cake recipes to combine flour, raising agent, sugar, milk, egg, and fat. I knew that the raising agent made gas bubbles that were caught in the batter as it cooked. But what were the other ingredients for?

I decided to try what geneticists call 'knockout'. If you turn off a single gene in a rockcress plant and the stalk grows crooked and wonky, then it’s probably a gene for straightness. In the same way, leaving out each of the standard cake ingredients one at a time might reveal what they do. And in the other direction, doubling each quantity could exaggerate its effect. Using a twelve-tray muffin tin, I was able to test many changes at the same time.

The method

Here is the basic recipe I started with:

Preheat the oven to 200º C. Sift two cups of self-raising flour (or two cups of all-purpose plain flour with two teaspoons of baking powder) with ¾ cup of fine sugar. In a second bowl, whisk one cup of milk with two eggs, half a teaspoon of vanilla essence, and ⅓ cup of canola oil. Add the liquid to the dry ingredients and mix until just combined, meaning that no flour is visible but lumps are still present. Pour the batter into twelve muffin tins and bake for 20 minutes.

For the first muffin tin, I scaled this recipe down to one twelfth its size. I prepared the egg by whisking two medium-sized eggs, measuring the volume, and dividing by twelve. I decided not to include the vanilla essence because it was too hard to scale down, and because its effect is obvious.


For the other tins, I made: a version with no raising agent; one with no egg; no milk; and no oil. I also made cakes with twice the raising agent; double the egg; yoghurt instead of milk; and double the oil. To round things out, I made one cake with melted butter instead of oil; one which I stirred vigorously instead of mixing gently; and, to get a sense of how much variability there might be, I finished by making the baseline recipe again. I baked the cakes for 20 minutes, turning the tray around halfway through to try to even out their cooking temperature. When the cakes had cooled a bit, I assembled a panel of cake experts to taste each one. We tried them in random order, without looking at the labels.

The baseline

The basic recipe made a cake that was reasonably good. It was moist, with a slightly crispy crust. It tasted ok, but quite bland, and had a hint of a smell like flour paste or olive oil. It clearly needed the vanilla essence, plus some kind of flavour (cocoa, fruit, nuts, jam, etc).


The cake without oil had large air bubbles. It was also crusty, bready and chewy. This might mean that the fat is normally catching the gas bubbles from the raising agent and keeping them small and separated, like an edible version of bubbles in soap.

On the other hand, the result of doubling the oil was more palatable. The cake was very moist and dense, with a consistency a bit like a French galette. Perhaps the gas bubbles had collapsed under the extra weight? But the end product was controversial. One taster gave it the thumbs down: too dense and solid. Another chose it as one of her favourites.


Recently I’ve been using neutral-flavoured oil in cake, instead of melted butter. Preparing butter takes extra time and generates washing up, and I figured that it’s all just different kinds of fat so I might as well pick the fast and easy version. I used one of the experimental cakes to test that assumption. (Some recipes ask for unsalted butter, then add back an ‘exact’ amount of salt, which is fine if you like that sort of thing. I used regular butter because we had it in the fridge.)

The results have made me change my mind. The muffin made with butter was delicious, tasting noticeably better than any of the others. It was also light, moist, and fluffy. From now on, it’s butter.


This was another surprise: changing the egg did next to nothing. The version without any egg at all turned out pretty fine, though it was a little dry. As for doubling the amount of egg, our tasting notes simply say “Meh”. (Admittedly, that was the tenth variation we tried, and we were beginning to feel cake fatigue.) Conclusion: using two eggs in a batch of cake mix isn’t worth it.


I tried making one portion without using milk, but it was immediately clear that it wouldn’t work, as it didn’t have enough liquid to mix properly. So I added an equal volume of water. It turned out dry, rough, and chewy. I suppose the milk must be helping to keep the cake moist and light.

In the other direction, I should have realised that doubling the quantity of milk wouldn’t work, and instead used cream. As it was, I grabbed the creamiest thing we had in the fridge—yoghurt. It didn’t work. The cake was muddy and chewy and had a slightly odd flavour.

Raising agent

As you might expect, the muffin without any raising agent was like a thick, wet, dense pancake. I half wondered whether doubling the baking soda would make it puff up like a balloon. In fact, it ended up a bit spongy and crumbly compared to the baseline, but the most noticeable thing was the flavour: quite bitter, and very weird. Don’t mess with the raising agent.


When you mix flour in liquid, the strands of gluten get tangled together, making it chewy. Does that matter for a cake? Yeah, nah. After whisking the batter as hard as I could for 60 seconds, the result was a bit chewy and bready, but still edible. Many cake recipes stress that you should mix the ingredients as gently as possible, which left me paranoid about overmixing. It turns out that I should have relaxed. I had to give myself an arm ache from whisking before we noticed any difference.

Conclusion: it’s cake time

Bottom line, here’s the recipe for little cakes I’m using now:

Preheat the oven to 200º, and grease a muffin tin. Melt about 100g of butter, and sift together 2 cups of self-raising flour with ¾ cup of fine sugar. In a second bowl, whisk one cup of milk with one or two eggs, half a teaspoon of vanilla essence, and the melted butter. Mix the liquid into the dry ingredients, without worrying about overmixing. Add some kind of fruit or flavouring: grated apple, crushed walnuts, fresh berries, or a dollop of jam in each cake. Bake in the muffin tin for 20 minutes.

Jamie Hall

Jamie Hall

Data scientist and software engineer at Kaggle. Previously a China hack and quant modeller at the RBA. These are my personal opinions.

Read More