Set temperature, volume and amount, watch pressure respond via PV = nRT.
Ideal Gas Law simulator
Drag the piston to change the volume
This simulation needs a modern browser with canvas support. The measurements and formula below still describe the physics.
Live measurements
Controls
Graph
Formula
P = n R T / V
- P Pressure
- —
Observations
What's happening
Real-world examples
Bike pump
Push the piston in and the same gas in a smaller volume climbs in pressure, and the air warms up.
Sealed can in the sun
Heat a fixed volume of gas and the pressure rises, which is why aerosol cans warn against heat.
Hot air balloon
Warming the gas lowers its density at fixed pressure, so the balloon floats upward.
Boyle isotherm
At fixed temperature, halving the volume doubles the pressure, tracing the P-V hyperbola on the graph.
▸ More about
Uses of ideal gas law
- Understanding why a bike pump warms up as you compress the air
- Seeing why a sealed can bursts when heated
- Explaining how a hot air balloon rises
- Introducing the kinetic theory of gases
ideal gas law pitfalls
- Using celsius instead of kelvin in the ideal gas law
- Thinking pressure comes from the weight of the gas
- Forgetting that pressure and volume are inversely related
ideal gas law questions (5)
What is the ideal gas law?
The ideal gas law states that PV = nRT: pressure times volume equals the amount of gas in moles times the gas constant R times the absolute temperature. Rearranged, the pressure is P = nRT / V. It ties together the four things that describe a gas, and it holds well for real gases at everyday pressures. The simulator runs it live, so changing any slider updates the pressure instantly.
Why does compressing a gas raise its pressure?
Squeezing the same amount of gas into a smaller volume packs the particles closer, so they strike the walls more often. Because P = nRT / V, halving the volume at fixed temperature doubles the pressure. This inverse link between pressure and volume is Boyle's law, and you can trace it as the P-V hyperbola on the graph while dragging the piston.
Why does heating a sealed gas raise its pressure?
Heating the gas makes the particles move faster, so they hit the walls harder and more often. At fixed volume and amount, pressure is proportional to the absolute temperature, so doubling the kelvin temperature doubles the pressure. That is why a sealed can left in the sun can burst. The simulator shows the particles speeding up as you raise the temperature.
Do I use celsius or kelvin in the ideal gas law?
Always kelvin. The ideal gas law needs an absolute temperature, where zero means no thermal motion, so you must convert celsius to kelvin by adding 273.15 first. Using celsius gives nonsense, including negative or zero pressures. The simulator works in kelvin throughout to keep the relationship correct.
What causes gas pressure?
Pressure comes from countless particle collisions with the container walls, not from the weight of the gas. Each impact gives the wall a tiny push, and the collective effect over the whole surface is the pressure. More particles, faster particles, or a smaller box all increase the collision rate and therefore the pressure, exactly as PV = nRT predicts.