🎈 Ideal Gas Law Solver (PV=nRT)

Last updated: June 17, 2026
Ideal Gas Law Solver
Enter any three values — the fourth is calculated automatically
PV = nRT
Solve for:
Result

All inputs auto-convert to SI before solving. Temperature in °C or °F is converted to Kelvin.
Standard conditions: STP = 273.15 K, 1 atm | SATP = 298.15 K, 100 kPa

What Is the Ideal Gas Law — and Why Does a Balloon Pop in Hot Weather?

You have probably noticed that a balloon left in a hot car gets bigger, sometimes dangerously so. Or that the tires on your bicycle feel harder in the summer than in the winter. These are not random annoyances — they are the Ideal Gas Law playing out in real life, every single day.

The Ideal Gas Law is one of the most elegant equations in all of science. It takes four different properties of a gas — pressure, volume, temperature, and the amount of gas — and ties them together into one compact relationship:

PV = nRT

That is it. Five symbols that describe how any gas behaves under most everyday conditions. Let us unpack what each one actually means, because each letter is hiding a surprisingly intuitive idea.

Breaking Down PV = nRT

P — Pressure. Imagine a gas as millions of tiny balls bouncing around inside a container. Every time one of these balls hits the wall, it pushes on it a little. Pressure is just the total force of all those tiny pushes, spread over the area of the wall. We measure it in atmospheres (atm), pascals (Pa), or sometimes millimetres of mercury (mmHg) if you are in a chemistry lab or reading a blood pressure monitor.

V — Volume. This is the amount of space the gas occupies. It could be a balloon, a piston inside an engine, a storage tank, or even just a sealed bottle. We usually measure it in litres (L) or cubic metres (m³) for engineering work.

n — Amount of gas (moles). A "mole" sounds strange, but it is just a counting unit — like how a "dozen" means 12. One mole of anything contains about 6.022 × 10²³ particles (atoms or molecules). If you have more gas molecules in the same space, you get more wall-hits, so pressure goes up.

R — The gas constant. This is a fixed number that makes all the units work out correctly. Its value depends on which units you are using. The most common is R = 0.082057 L·atm/(mol·K) when working with litres and atmospheres. In pure SI units it is 8.31446 J/(mol·K). Think of R as the "conversion factor" that bridges the world of molecules to the world of pressure gauges and thermometers.

T — Temperature, in Kelvin. This is the critical one that trips people up. You must use Kelvin, not Celsius or Fahrenheit. Why? Because Kelvin starts at absolute zero — the point where molecules have virtually no kinetic energy and stop moving. If you plugged in 0°C (which feels cold but is actually 273.15 K), you would not get a result of "zero volume." That makes sense, because molecules still have energy at 0°C. Absolute zero (0 K = −273.15°C) is the only true zero for gas calculations.

The Big Insight: All Four Variables Are Linked

The real power of PV = nRT is that if you know any three of the four variables (P, V, n, T), you can always find the fourth. You just rearrange the equation:

  • To find Pressure: P = nRT / V
  • To find Volume: V = nRT / P
  • To find Moles: n = PV / RT
  • To find Temperature: T = PV / nR

This is exactly what the calculator above does — you pick which variable you want to solve for, fill in the other three, and hit Calculate.

A Classic Example: Molar Volume at STP

At Standard Temperature and Pressure (STP) — defined as 0°C (273.15 K) and 1 atm — one mole of any ideal gas occupies exactly 22.414 litres. You can verify this with the calculator: set n = 1 mol, T = 273.15 K, P = 1 atm, and solve for V. You will get 22.4 L, the famous "molar volume" that chemistry students memorise.

This number is remarkable because it does not matter if the gas is hydrogen, oxygen, or carbon dioxide. One mole of any ideal gas takes up the same volume at STP. The type of molecule does not matter — only how many molecules there are, how fast they are moving (temperature), and how much space they have (volume).

Why "Ideal"? When Does It Break Down?

The law is called the "Ideal" Gas Law because it assumes gases behave in a perfectly simplified way. Specifically, it assumes:

  • Gas molecules have no volume of their own (they are point particles).
  • There are no attractive or repulsive forces between molecules.
  • All collisions are perfectly elastic (no energy is lost).

Real gases deviate from this ideal behaviour under two conditions: very high pressure (molecules are squeezed so close that their actual size matters) and very low temperature (where attractive forces between molecules become significant and can cause the gas to condense into a liquid). For most everyday engineering scenarios — room temperature gases, moderate pressures — the Ideal Gas Law is accurate to within a few percent, which is perfectly fine for most calculations.

When you need higher accuracy with real gases at extreme conditions, engineers use the Van der Waals equation or more sophisticated equations of state like the Peng-Robinson equation. But those are advanced territory. For most fluid mechanics, thermodynamics coursework, and industrial estimation, PV = nRT is the starting point.

Real-World Applications

The Ideal Gas Law shows up in engineering and science constantly:

HVAC and pneumatics: Engineers use it to calculate how much air (at what pressure) needs to be pumped into a system. If you know the temperature will rise in a sealed tank, you can calculate the resulting pressure increase before the tank ruptures.

Combustion engines: Inside a car engine cylinder, a mixture of air and fuel is compressed and ignited. The rapid temperature increase causes a huge pressure spike that pushes the piston — PV = nRT describes exactly why.

Scuba diving: At depth, a diver's lungs are under much higher pressure. A breath of air at 30 metres depth (about 4 atm) would expand to four times the volume if brought to the surface — which is why divers must exhale slowly while ascending.

Meteorology: Weather balloons are filled with only a small amount of helium at ground level. As they rise and atmospheric pressure drops, the volume expands dramatically — calculated directly from the Ideal Gas Law.

Chemistry labs: Whenever a reaction produces a gas, chemists use PV = nRT to calculate how many moles were produced by measuring the gas volume, temperature, and pressure in a collection flask.

Unit Pitfalls to Watch Out For

The single biggest source of errors with the Ideal Gas Law is mixing up units. The value of R you choose must match the units of P and V you are using. The calculator above handles this automatically by converting everything internally to litres and atmospheres before solving, so you can freely mix units without worrying about it.

But if you are working by hand, remember: always convert temperature to Kelvin first. A temperature in Celsius gives you a negative number close to zero for many room-temperature problems, which will give nonsensical results. Adding 273.15 to your Celsius value before plugging it in is non-negotiable.

The Ideal Gas Law is one of those rare tools that stays useful your entire engineering career. Whether you are a first-year chemistry student or a process engineer designing a gas pipeline, PV = nRT is always within reach — simple enough to write on the back of an envelope, powerful enough to describe the behaviour of the atmosphere itself.

FAQ

Why must temperature be in Kelvin for the Ideal Gas Law?
The Ideal Gas Law relates temperature to the kinetic energy of gas molecules. Kelvin (K) is the only temperature scale that starts at true absolute zero — the point where molecular motion theoretically stops. Using Celsius or Fahrenheit would give incorrect results because those scales have arbitrary zero points. To convert: K = °C + 273.15. So 25°C becomes 298.15 K.
What is the difference between STP and SATP, and which should I use?
STP (Standard Temperature and Pressure) is the older standard: 0°C (273.15 K) and 1 atm. At STP, one mole of ideal gas occupies 22.414 L. SATP (Standard Ambient Temperature and Pressure), more commonly used today, is 25°C (298.15 K) and 100 kPa (about 0.987 atm). At SATP, one mole occupies 24.789 L. IUPAC now recommends SATP for most chemistry work, but STP is still widely used in physics and engineering textbooks. Always check which standard your textbook or problem uses.
Which value of R (gas constant) should I use?
R is always the same physical constant — only its numerical value changes depending on which units you pair it with. Use R = 0.082057 L·atm/(mol·K) when pressure is in atmospheres and volume is in litres. Use R = 8.31446 J/(mol·K) for SI units (Pa and m³). Use R = 8.31446 L·kPa/(mol·K) when working in kilopascals with litres. The calculator above lets you pick the unit system and handles the correct R automatically.
When does the Ideal Gas Law give inaccurate results?
The Ideal Gas Law assumes gas molecules have no volume and exert no forces on each other. This breaks down at very high pressures (above roughly 10–50 atm, where molecules are packed tightly) and at very low temperatures (near the boiling point of the gas, where intermolecular attractions become significant). For example, real CO₂ at high pressure deviates noticeably from PV = nRT. For those cases, engineers use the Van der Waals equation or compressibility factor (Z) corrections.
Can I use the Ideal Gas Law for mixtures of gases?
Yes, through Dalton's Law of Partial Pressures. Each gas in a mixture behaves independently as if it were the only gas present. The total pressure is the sum of all partial pressures (P_total = P₁ + P₂ + P₃...), where each partial pressure is calculated using PV = nRT for that gas's own mole count. Air, for example, is a mixture of nitrogen, oxygen, argon, and other gases — each contributing its own partial pressure to the total atmospheric pressure.
How do I find the number of moles if I only know the mass of the gas?
Divide the mass by the molar mass of the gas. For example, if you have 32 grams of oxygen gas (O₂), the molar mass of O₂ is 32 g/mol, so n = 32 g ÷ 32 g/mol = 1 mol. For carbon dioxide (CO₂, molar mass 44 g/mol), 88 g gives n = 2 mol. Once you have n, plug it into PV = nRT with the other known values to solve for the remaining variable.