Home › Science › Ideal Gas Law Calculator

Ideal Gas Law Calculator (PV = nRT)

Enter pressure, volume and temperature to find how many moles of gas are present. Add a molar mass to get the gas's mass in grams.

atm
L
°C
g/mol

Amount of gas

—

Temperature in kelvin
—
Mass of gas
—
Molecules
—

Four quantities, one constant

For most gases near everyday conditions, pressure, volume, temperature and the amount of gas are tied together by a single equation. Fix three and the fourth follows. This calculator solves for the amount, in moles, and converts it to mass and molecules.

At 1 atm and 0 °C (273.15 K), 22.4 L of gas holds 0.9994 mol, about 6.02 × 10²³ molecules. That is the classic "one mole occupies 22.4 L at STP".

Moles held in your volume by temperature0 mol0.25 mol0.5 mol0.75 mol1 mol1.25 mol-5016.783.3150Temperature (°C)
Amount of gas at your pressure and volume from −50 °C to 150 °C.

The equation and its constant

n = P × V ÷ (R × T)
R = 0.082057 L·atm/(mol·K)
T (K) = °C + 273.15
Mass = n × molar mass; molecules = n × 6.02214076 × 10²³

Temperature must be absolute. Using °C directly gives nonsense, and at 0 °C would divide by zero.

Warmer gas, fewer moles in the same space

The chart holds your pressure and volume fixed and changes the temperature. Hot gas is less dense, so a fixed container holds fewer moles. That is why a balloon shrinks in the cold and why tyre pressure drops on a winter morning.

Converting pressure

This calculator takes pressure in atmospheres. 1 atm = 101.325 kPa = 1.01325 bar = 14.696 psi = 760 mmHg. Tyre gauges show gauge pressure, above atmospheric; add about 1 atm (14.7 psi) to get absolute pressure.

The same 22.4 L in different conditions

22.4 L of oxygen (32.00 g/mol)
ConditionPressureTempMolesMass
STP (old definition)1 atm0 °C0.9994 mol31.9801 g
Room conditions1 atm25 °C0.9156 mol29.2985 g
Denver altitude0.83 atm20 °C0.7729 mol24.7325 g
Scuba tank pressure200 atm20 °C186.239 mol5,959.6468 g

Worked case: air in a room

The law handles everyday questions as well as lab problems. A room of 1,000 liters (one cubic meter) of air at 1 atm and 20 °C holds about 41.6 mol of gas, which weighs about 1.2 kg, using 28.97 g/mol as the average molar mass of dry air. Heat the same room to 100 °C at the same pressure and the moles that fit drop to about 32.7 mol, because warm gas is less dense. That density drop is what makes a hot air balloon rise.

Units that trip people up

  • Temperature must be absolute. The calculator converts Celsius to kelvin (273.15 K for the default), and forgetting that step is the most common error.
  • With R = 0.08206, pressure is in atmospheres and volume in liters. Using kPa or cubic meters requires R = 8.314.
  • Gauge pressure, as read on a tire gauge, excludes the atmosphere. Add about 1 atm to get the absolute pressure the law needs.

When the ideal gas law fails

Real molecules take up space and attract each other. The ideal model works well for air, nitrogen, oxygen and helium at moderate conditions. It drifts at high pressure and at temperatures near a gas's boiling point, where equations such as van der Waals do better. Steam near saturation and refrigerants are poor fits.

Related tools

To turn moles in solution into concentration, use the molarity calculator. For changing °F to °C or K, see the temperature converter. The volume calculator finds the size of a tank, and thermal expansion covers solids.

Ideal gas questions

What is R in PV = nRT?

The gas constant, 0.082057 L·atm/(mol·K) or 8.314 J/(mol·K).

Why must temperature be in kelvin?

The law is proportional to absolute temperature, which starts at absolute zero.

Does one mole always occupy 22.4 L?

Only at 0 °C and 1 atm. At 25 °C it is about 24.5 L.

Is scuba tank pressure ideal?

Not quite. At about 200 atm real air deviates by several percent.

Related calculators