# Gas particles in a box > How does a gas push on its container? Watch gas molecules bounce in a box, change the temperature and the number, and compare the pressure with the ideal gas law. Simulate gas molecules in a box: set the temperature, gas and particle count, and watch the pressure form and the speeds follow the Maxwell–Boltzmann curve. - Page: https://how.box/gas-sim/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/gas-sim/?g={g}&t={t}&n={n}&w={w} - `g` (hydrogen, helium, nitrogen, argon or carbon-dioxide): hydrogen, helium, nitrogen, argon or carbon-dioxide. Example: `nitrogen`. - `t` (number 10 to 2000): Temperature. Example: `300`. - `n` (whole number 10 to 400): Number of molecules. Example: `150`. - `w` (number 20 to 200): Width of the box. Example: `50`. Example answer: https://how.box/gas-sim/?g=nitrogen&t=300&n=150&w=50 A complete link carries the primary answer in the page HTML; a missing or invalid value shows the default page. ## Agent tools - `gas_sim_state`: Kinetic theory of a gas of non-colliding molecules in a two-dimensional box (the page animates it). - MCP, one POST to https://how.box/mcp: `{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"gas_sim_state","arguments":{"gas":"nitrogen","temperature_k":300,"particles":150,"box_width_nm":50}}}` - GET: https://how.box/mcp/run/gas_sim_state?gas=nitrogen&temperature_k=300&particles=150&box_width_nm=50 ## How it works A gas is a crowd of molecules flying in straight lines and bouncing off the walls. Each bounce pushes the wall a little; billions of bounces a second add up to a steady pressure. A hotter gas has faster molecules, so each bounce pushes harder and more often. A smaller box makes the bounces more frequent. Kinetic theory puts numbers on it. The molecules do not all move at the same speed: their speeds follow the Maxwell–Boltzmann distribution, which gives the most probable speed √(kT/m) in this flat box, with k the Boltzmann constant, T the temperature and m a molecule's mass. Light molecules such as hydrogen are faster than heavy ones such as carbon dioxide at the same temperature. The ideal gas law says that pressure times area equals N·k·T, with N the number of molecules. For example, 150 nitrogen molecules at 300 K in this box press on the walls with 414 µN/m. The simulation is a flat, two-dimensional box, so pressure is a force per length instead of per area, the molecules do not collide with each other (an ideal gas) and time is slowed down by a factor of about ten trillion. Source: OpenStax University Physics, volume 2, chapter 2. ## FAQ **Why does the measured pressure wobble?** The pressure comes from a finite number of bounces over a short time, so it jitters around the ideal value. More molecules and a longer wait make it steadier. **Do all molecules move at the same speed?** No. Collisions spread the speeds out into the Maxwell–Boltzmann distribution: a few are slow, most are near the peak and a few are fast. The temperature only fixes the overall scale. **Why are helium and hydrogen faster than nitrogen?** At one temperature all gases have the same average kinetic energy, so lighter molecules must move faster to carry the same energy. **Why is the pressure in newtons per metre?** The box is flat, a two-dimensional world, so the walls are lines. Pressure there is a force per length. In a real three-dimensional box it would be a force per area, in pascals. **Is time really that slow?** Molecules move at hundreds of metres per second, but a box 50 nanometres wide is crossed in about 50 picoseconds. The animation runs about ten trillion times slower than reality so that you can see it. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)