Kinetic theory lab

Ideal Gas Simulator

Hundreds of gas molecules bounce around a box. Heat or cool them, push the piston to compress the gas, and measure pressure, temperature and volume. Check the ideal gas law, watch speeds settle into the Maxwell–Boltzmann curve, and explore diffusion and Brownian motion.

TEMPERATURE1.00
PRESSURE0
AREA0
P·A / N·k·T–

Molecular speeds

molecules Maxwell–Boltzmann
P · A = N · k · T

Drag the piston handle or use the Volume slider. H heat · C cool · Space pause · F full screen

How the simulation works
  1. Molecules are hard disks that move in straight lines and bounce elastically off each other and the walls — energy and momentum are kept.
  2. Temperature is the average kinetic energy per molecule (2D, k = 1). Pressure is the total push of molecules hitting the walls per unit wall length.
  3. The piston is a moving wall: pushing it in gives molecules extra speed (the gas heats up), pulling it out cools the gas. The thermostat gently steers the temperature back to its target.
  4. Real molecules take up space, so P·A/(N·k·T) is a little above 1 when the gas is dense — like a real (van der Waals) gas.

Simple units (k = 1) in two dimensions. Everything runs in your browser.

Using Ideal Gas Simulator

Watch gas molecules bounce around a box. Heat it, cool it, compress it with a piston and measure pressure, volume and temperature. Check the ideal gas law, see the Maxwell–Boltzmann speed distribution, and explore diffusion and Brownian motion.

  1. Press Play: molecules fly around and bounce off each other and the walls. Their colour shows their speed.
  2. Use Heat and Cool to change the temperature, and drag the piston (or use the slider) to change the volume.
  3. Read pressure, temperature and the PV/NkT ratio — it stays close to 1 for an ideal gas.
  4. Open Charts for the speed distribution against the Maxwell–Boltzmann curve, and pressure over time.
  5. Try the examples: Boyle's law, hot meets cold, diffusion of two gases, Brownian motion and effusion through a hole.

Example

Boyle's law: halving the volume at the same temperature doubles the pressure.
Brownian motion: one big particle jiggles randomly because small molecules keep hitting it.

Questions & answers

What is the ideal gas law?

PV = NkT (or PV = nRT): pressure times volume equals the number of molecules times Boltzmann's constant times temperature. This 2D simulator uses area instead of volume and simple units where k = 1.

How is pressure measured?

Every time a molecule bounces off a wall it pushes on it. The simulator adds up these pushes (momentum changes) over time and divides by the wall length.

What is temperature here?

The average kinetic energy of the molecules. Heating speeds them all up, cooling slows them down.

What is the Maxwell–Boltzmann distribution?

The spread of molecular speeds in a gas at one temperature. Collisions quickly turn any starting speeds into this shape, which you can see in the Charts tab.

What is diffusion?

The slow mixing of two gases caused by random molecular motion. Remove the divider and watch the colours mix.

What is Brownian motion?

The random jiggling of a large particle hit by many small molecules — the evidence Einstein used in 1905 to prove molecules exist.

Does it run on my device only?

Yes. Everything runs in your browser.

Help improve this tool

Report a problem or suggest an improvement

Describe the issue without pasting private tool input. Feedback goes to our admin inbox.

Find another tool · Read practical guides