💨 Ideal Gas Law Calculator

Last updated: March 30, 2026

💨 Ideal Gas Law Calculator

Solve PV = nRT for any unknown variable with flexible units

PV = nRT
Fill M above → density shown in result

What Is the Ideal Gas Law, and Why Does It Matter?

Picture this: you leave a sealed plastic water bottle in your car on a hot summer day. When you come back, it looks bloated — like it's about to pop. That's the ideal gas law doing its thing. The relationship between pressure, volume, temperature, and the amount of gas isn't random. It follows a clean, reliable equation that chemists, engineers, and even scuba divers rely on every single day.

The equation is simple enough to tattoo on your wrist: PV = nRT. Four variables, one constant, and an enormous amount of predictive power packed into five characters.

Breaking Down PV = nRT Variable by Variable

P is pressure — the force the gas exerts on the walls of whatever container it's in. You can measure it in atmospheres (atm), kilopascals (kPa), bars, millimeters of mercury (mmHg), pascals (Pa), or even pounds per square inch (psi). They're all just different ways of counting the same thing.

V is volume — how much space the gas occupies. Litres are the most common unit in chemistry, but cubic meters show up in engineering, and cubic feet appear in older industrial contexts. The key insight is that gas fills whatever container it's in — it doesn't sit at the bottom like a liquid would.

n is the amount of gas in moles. One mole is Avogadro's number of molecules — roughly 6.022 × 10²³ of them. That sounds absurd, but a mole of air molecules weighs only about 29 grams. It's a convenient way to count things that are too small to see.

R is the gas constant. This is the glue that holds the equation together. Its value depends entirely on which units you're using for the other variables. When pressure is in atm and volume is in litres, R equals 0.08206 L·atm/(mol·K). In SI units (pascals and cubic meters), R is 8.314 J/(mol·K). The physics doesn't change — only the numbers we use to describe it do.

T is temperature in Kelvin. This is where beginners often trip up. You cannot plug in Celsius or Fahrenheit directly. Temperature in the ideal gas law must always be in Kelvin, because the equation breaks down at 0°C (which isn't actually zero energy). To convert: K = °C + 273.15. Room temperature (25°C) becomes 298.15 K.

Where Did This Equation Come From?

The ideal gas law didn't appear overnight. It's a combination of three older laws discovered independently over about 150 years.

Boyle's Law (1662) said that at constant temperature, pressure and volume are inversely proportional: squeeze a gas into half the space and its pressure doubles. Charles's Law (1787) added that at constant pressure, volume is directly proportional to temperature — heat a gas and it expands. Avogadro's Law (1811) completed the picture by showing that equal volumes of different gases at the same temperature and pressure contain equal numbers of molecules.

Combine all three and you get PV = nRT. The French physicist Émile Clapeyron wrote it in its modern combined form in 1834. It's been a cornerstone of chemistry and physics ever since.

Solving for Each Variable — And When You'd Actually Do That

Rearranging the equation is straightforward algebra:

  • Find pressure: P = nRT / V — useful when you've loaded a fixed amount of gas into a rigid tank and need to know how much pressure builds up as temperature rises.
  • Find volume: V = nRT / P — used when inflating balloons, designing gas storage vessels, or figuring out how much space a certain amount of gas will take up at a given altitude.
  • Find moles: n = PV / RT — handy when you measure the volume and conditions of a gas sample and want to know how many moles are present without weighing them.
  • Find temperature: T = PV / nR — less common but useful when reverse-engineering conditions from observed gas behavior.

A classic application: at Standard Temperature and Pressure (0°C, 1 atm), exactly one mole of an ideal gas occupies 22.414 litres. This "molar volume" is a benchmark that every chemistry student memorizes. At Normal Temperature and Pressure (20°C, 1 atm), that same mole takes up 24.04 litres — because warmer gas expands.

The "Ideal" Part — What the Law Assumes

The word "ideal" is doing a lot of work here. An ideal gas is a theoretical construct — it assumes gas molecules have no volume of their own, and they don't attract or repel each other at all. Real molecules do both of these things, which means the ideal gas law is an approximation.

It's a very good approximation under most conditions you'll encounter — low pressure, moderate temperature, and gases that aren't close to condensing into liquids. Nitrogen, oxygen, and helium at room conditions behave almost perfectly ideally. But compress gas to very high pressures (like inside a cylinder engine) or cool it close to its boiling point (like liquid nitrogen approaching -196°C), and you'll see deviations. That's when you need the Van der Waals equation or other real-gas corrections.

For practical engineering work, lab chemistry, and most physics problems though? PV = nRT is accurate to within a few percent under normal conditions, which is plenty good enough.

Molar Volume and Gas Density — Two Bonus Quantities

Once you know P, V, n, and T, two more useful values fall right out:

Molar volume (Vm) is just V/n — the volume occupied by one mole of gas at those conditions. At standard conditions it's about 22.4 L/mol, but it changes with temperature and pressure. High altitude means lower pressure, which means larger molar volume — which is part of why your ears pop on an airplane.

Density requires one extra piece of information: the molar mass (M) of the gas. Density = PM / RT, in consistent units. For air (average molar mass ≈ 28.97 g/mol) at 25°C and 1 atm, density works out to about 1.184 g/L or 1.184 kg/m³. This is why hot air balloons work — heat the air inside, density drops, buoyancy takes over.

Real-World Examples You Might Not Expect

Weather balloons use this equation. As they rise, pressure drops and the balloon expands — V increases as P decreases, just as the law predicts. The balloon is designed to burst when it reaches a specific volume at a specific altitude.

Anesthesiologists use it. When calculating the correct dose of an inhaled anesthetic gas, you need to know how many moles of gas are in a certain volume at body temperature and the patient's respiratory pressure.

Automotive engineers use it to model the air-fuel mixture in a cylinder before ignition. The compression stroke reduces volume dramatically, which (by the ideal gas law) spikes both temperature and pressure — exactly what you need for combustion to happen.

Even your car tires: manufacturers specify tire pressure at a standard "cold" temperature. On a long highway drive, friction heats the tires, T increases, and so does P — which is why the recommendation is always to check tire pressure when they're cold.

Tips for Getting the Right Answer

The single most common mistake is mixing unit systems. If you use R = 0.08206 L·atm/(mol·K), then pressure must be in atm, volume in litres, amount in moles, and temperature in Kelvin — no exceptions. Mixing in kPa or Celsius with that R value will give you a wrong answer that looks plausible, which is the worst kind of wrong.

The calculator on this page handles all of that automatically by converting everything to SI internally (Pa, m³, mol, K) with R = 8.314 before solving, then converting the answer back to your chosen display units. That way you can freely mix units without worrying about which R value to use.

Start simple: try plugging in standard conditions (P = 1 atm, n = 1 mol, T = 0°C) and solve for V. You should get 22.414 litres. If you do, you know the setup is correct and you can trust the calculator for your actual problem.

FAQ

What units does R have, and which value should I use?
R is the universal gas constant and its numerical value depends entirely on your chosen units. Use R = 0.08206 L·atm/(mol·K) when pressure is in atmospheres and volume in litres. Use R = 8.314 J/(mol·K) for SI units (pascals and cubic meters). Use R = 0.08314 L·bar/(mol·K) for bar pressure. This calculator converts all inputs to SI automatically, so you can mix units freely without choosing R manually.
Why do I need to convert temperature to Kelvin?
Because the ideal gas law only works when temperature represents absolute thermal energy, not a relative scale. At 0°C, gas molecules still have kinetic energy — they haven't stopped moving. Kelvin starts at absolute zero (−273.15°C), where molecular motion theoretically ceases. If you plug in 0°C directly, the equation would predict zero volume or pressure, which is physically wrong. Always add 273.15 to your Celsius temperature before using PV = nRT.
What is molar volume and why is 22.4 L/mol special?
Molar volume (Vm) is the volume occupied by exactly one mole of an ideal gas under a specific set of conditions. At STP (0°C and 1 atm), that value is approximately 22.414 litres per mole — a benchmark memorized by every chemistry student. At different temperatures or pressures the molar volume changes proportionally. At 25°C and 1 atm (closer to room conditions), it rises to about 24.5 L/mol.
When does the ideal gas law break down?
The ideal gas law assumes gas molecules have no size and no intermolecular attractions. Real gases deviate noticeably at very high pressures (where molecules are packed so tightly their own volume matters) and very low temperatures (where attractive forces between molecules become significant and condensation approaches). For gases like nitrogen and oxygen at everyday temperatures and pressures below ~10 atm, the ideal gas law is accurate within a fraction of a percent. Near boiling points or above ~50 atm, use the Van der Waals equation instead.
How do I calculate the density of a gas using the ideal gas law?
You need the molar mass (M) of the gas in addition to pressure and temperature. The formula is: density = PM / RT, where P is in Pa, M is in kg/mol, R = 8.314, and T is in Kelvin. The result comes out in kg/m³. In more practical units: density (g/L) = P(atm) × M(g/mol) / (0.08206 × T(K)). For example, air with M ≈ 28.97 g/mol at 25°C and 1 atm gives a density of about 1.18 g/L.
Can I solve for two unknowns at once?
No — the ideal gas law is one equation with four variables. You need to know three of them to find the fourth. If you have two unknowns, you need a second independent equation (for example, a fixed mass constraint or a known ratio of pressure to volume from another law). In practice, most problems specify three variables and ask you to solve for one, which is exactly what this calculator does.