filled profiteroles with creme patissiere

The ideal gas law in food – On expanding and shrinking foods

Have you ever made souffles? Have you experienced that thrill when they rise high in the oven, but sink down again once you take them out? Have you ever covered an egg in a frying pan with a lid and seen it expand enormously, only to collapse again when you lift the lift? Or more common examples, have you seen a cake lift in the oven or choux pastry rise?

Of course, you might have not thought twice, but chances are that you did think twice, since you landed on this post. You’re curious to understand why they happen. And even though some chemistry might be involved, the actual rising is a purely physical process. Gases shrink and expand and it happens all the time in food and during cooking.

Most of these phenomena can be explained (at least partly) through the Ideal Gas Law. This simple law will help you understand how gases expand, shrink, and how pressure and volume are affected by it.

Phase changes – Solid – liquid – gas

In order to understand this shrinking and expanding foods, let’s take a few steps back. To describe the different states our food can be in, we use phases and phase changes. A water can be solid, then it’s ice, liquid or a gas, it’s vapour. A lot of components in foods can be described to be either solid, liquid or a gas. There are some additional complications here, but we’ll keep it simple and stick with solid, liquid and gas.

Solids, liquids and gases behave quite differently. In solids the molecules don’t really move around freely. In a liquid these molecules can move around quite freely, however, they prefer to stick to one another. They won’t fill up an entire space (instead, the water will all sit at the bottom of a glas). A gas on the other hand has molecules that can float around pretty freely. A water vapour will fill up a chamber. (Find more background information here.)

For the expanding and shrinking souffle we need to focus our attention to the gas phase.

A bowl full of pingpong balls

The ideal gas law is a very simple way to describe such a gas phase. In reality most gases are not ideal though. However, the basic principles and reasoning are very close to that for ‘real’ gases. It does have some limitations for various ‘real’ gases, but for now there’s no need to dig deeper into this, we’ll be able to explain the examples in food mentioned earlier just fine with this law.

But why aren’t normal gases ideal? That’s where the bowl of pingpong balls comes in. In an ideal gas you assume that the molecules that make up a gas do not have any attractions between one another. In other words, they will not stick to each other, or push or pull away from other molecules. In other words, you’re looking at a bowl full of floating pingpong balls. They can bounce into one another, but they won’t stick, the pingpong balls don’t attract one another either.

Another assumption for ideal gases is that the size of molecules isn’t important. However, this does tend to be of influence in various scenarios. That said though, let’s assume for now that our gases in our foods are super small floating ping pong balls. They all float around randomly, they might bump into one another, but that’s it.

The ideal gas law

Now that we’re assuming our foods contain ideal gases, let’s have a look at this ideal gas law. This law describes how such an ideal gas behaves when temperature or pressure changes, or when the volume changes. The law is as follows:

pV = nRT


  • p = pressure (the unit is Pa)
  • V = volume (unit = m3)
  • n = number of molecules (expressed in the unit ‘moles’)
  • R = gas constant, this is a fixed number that’ll always be the same (8,314 J/molK)
  • T = temperature (unit = Kelvin)

The formula indicates that there is a relationship between pressure, volume, gas constant, number of molecules and temperature. This is best explained with a few examples.

Ideal gas law example 1 – Popping popcorn

Imagine a vessel (or a huge popcorn corn kernel) of 1 m3 at a temperature of 300 K and a pressure of 100.000 Pa. Using these three variables you can calculate how many moles of a gas sit in the corn kernel:

p x V = n x R x T –> n = (p x V) / (R x T) –> n = (100.000 x 1) / (8,314 X 300) =  40 moles

Now, let’s heat up this kernel to 400K. Remember, this is a very strong (it cannot bulge or expand even a little) and closed corn kernel. There is no way molecules can go in our out (in reality more gas molecules will be formed due to the evaporation of water inside the kernel, but we’ll neglect those for now). The gas constant and the volume will remain the same as well.

The formula still applies and the only way to make it work is to change p, the pressure. This is what commonly happens, if a gas is heated in a completely closed vessel the pressure in the vessel will build up. In the formula this results in:

p x V = n x R x T –> p = (n x R x T) / V –> p = (40 x 8,314 x 400) / 1 = 133.333 Pa.

This is exactly what happens when popping popcorn! The pressure builds up in this exact way, until the kernel cannot handle it anymore and explodes.

The pressure build up can only take place if your vessel or kernel is strong enough to handle the pressure. There are a lot of foods where that isn’t the case, as we’ll see in the second example.

freshly popped popcorn

Ideal gas law example 2 – Baking a souffle

Now imagine a vessel of again 1m3 at a temperature of 300 K, a pressure of 100.000 Pa and those 40 moles of a gas. Again we’ll heat the vessel. Now imagine though that this vessel is a souffle batter. Souffle batters are very delicate and are made of whipped egg whites with some sort of liquid mixed through so it contains a lot of air bubbles. Let’s heat this batter to 400K.

You might now expect the pressure to go up again, as we saw in example 1. However, this souffle batter isn’t as strong as the rigid vessel! Instead of the pressure increasing, the cake batter will expand! This souffle batter cannot handle any pressure increase, so the pressure will stay constant. For now we’ll assume that no gas actually escapes the batter and that no new gas is made, we’ll come back to those later.

p x V = n x R x T –> V = (n x R x T) / p –> V = (40 x 8,314 x 400) / 100.000 = 1,3m3

The souffle batter has grown in size!

One great challenge with souffles is always to prevent them from collapsing after you take them out of the oven. Unfortunately, this is practically impossible. A souffle, even a cooked one, has a very delicate structure. As soon as you take the souffle out of the oven the temperature of the souffle will decrease. So the volume simply has to decrease again. A slightly firmer souffle can limit shrinking, but in the end, just about all souffles sink to a certain extent.

In the next example we will add a third phenomenon: the number of molecules may increase as well.

chocolate zucchini courgette cake with frosting



Ideal gas law example 3 – Baking a cake



Last but not least, in a lot of foods the number of gas molecules in a food isn’t constant. When baking a cake, popping popcorn or baking a souffle water will evaporate. This evaporated water will result in additional gas molecules, taking part in the ideal gas law. In cakes it isn’t only water though. Instead, the addition of baking powder and soda will result in the formation of carbon dioxide gas. Again, additional gas molecules!

For this last example we now take such a cake batter with 40 moles of gas, a temperature of 300K, a volume of 1mand a pressure of 100.000 Pa. We again increase the temperature to 400K. However, this time, a lot of new gas molecules are formed. This results in a total for 60 moles of gas molecules. Since the cake batter isn’t very strong it won’t be able to withstand any higher pressures, so the pressure will stay constant. Let’s have a look at the size of this cake with additional gas molecules.

p x V = n x R x T –> V = (n x R x T) / p –> V = (60 x 8,314 x 400) / 100.000 = 2,0m3

See how much larger this cake has gotten? Of course, in reality we will need to make sure not too much gas has formed or the cake can implode, being unable to handle all this additional gas.

n is gas molecules only

Wondering how n can increase even though no new mass is formed? When looking at the ideal gas law n represents the number of gas molecules only. This is because liquid or solid structures do not participate in the gas law. They will stay put and will not influence pressure, etc. However, once such a liquid evaporates, for instance in the oven, it will participate! It will also want to fill up some space and participate with all those other pingpong balls.

Combining forces

In most foods it is the combination of these three example that make the story complete. In the case of popcorn the number of gas molecules will also increase because more and more water will evaporate and turn into a gas. The same for the souffle. Water in the souffle will evaporate and become a gas and participate in this gaseous behaviour. What’s even worse. When taking the souffle out of the oven some of this water will condense again. This will contribute to the shrinkage of the souffle even further.

Often a whole lot more processes play a role as well. Structures don’t tend to be either super rigid or super flexible, instead most likely pressure, volume, number of gas molecules and temperature will all change simultaneously. Or some might start at the start of the cooking process, whereas others change towards the end. That said though, you don’t have to understand every single detail, to still grasp these basic concepts!

Want another great example of gas at work? Read up on choux pastry. A soft liquid, air-less choux pastry dough rises into this amazingly airy puffs. It’s a combination of an increase of gas molecules, expanding the batter.



  • In your popcorn and souffle examples you say that n, the number of moles of substance (water in both the examples) is increasing. Are you sure about this? Where in the system are additional moles of water coming from? If you consider the system the popcorn kernel in the first example, isn’t the point that n is constant until the kernel structure can no longer withstand the increased pressure and rapidly expands in volume/explodes? At that point n in the kernel has decreased if some if the water vapor escaped during the kernel bursting. I’m having a hard time seeing why n would ever increase in these examples.

    • Hello Whit,
      Thank you for your comment! As a result, I decided to rewrite most of the post to make it somewhat clearer.
      It is true though that n will increase in a popcorn kernel. Keep in mind that n represents the number of gas molecules. If some of the water in a corn kernel evaporates the value of n will increase, even though no new molecule has been formed. It’s just that the liquid molecules do not participate at all in gas behaviour.
      So for a popcorn kernel T (the temperature) increases, which causes an increase in pressure, this is magnified by the fact that also some of the moisture will evaporate in the kernel, increasing the pressure even further. This will eventually result in a popping kernel. At that point, the pressure returns back to normal since the volume has increased and most likely part of the water vapour has evaporated.

      Hope that helps!

  • Would you be willing to allow me to print this post as a PDF and upload to our school system webpage? Or do you have a copy you could email me that has your blog name/signature on it? I can not link to the blog due to firewall restrictions, but I love your article and want to share it with students/teachers!

  • Thank you! It was very useful and you presented all the stuff in the basic thermodynamics terms. Nice and easy!

Newsletter square-1

Want to improve your food?


Vegetable Science
ask a question-1
Cookie science - baking cookies with a pinch of science