Math & Science

Gas Volume Calculator

The ideal gas law, solved for whichever variable you are missing.

Written and maintained by the MarsCalc Hub editorial team Formula checked against the CODATA gas constant and IUPAC standard conditions Updated
L
mol

About the Gas Volume Calculator

The ideal gas law ties together the pressure, volume, amount and temperature of a gas in one equation: PV = nRT. Leave any one of those four blank and this calculator solves for it.

Units are handled for you. Pressure can go in as pascals, kilopascals, bar, atmospheres, psi or mmHg; temperature as kelvin, Celsius or Fahrenheit. Everything is converted to SI before the arithmetic, which removes the most common source of error in gas law problems.

The gas constant used is R = 8.314462618 J/(mol·K), the exact CODATA value. Since the 2019 SI redefinition, R follows exactly from the defined Boltzmann and Avogadro constants, so it is no longer a measured quantity with uncertainty.

How to use the Gas Volume Calculator

  1. Choose which variable to solve for.
  2. Enter the other three, using whatever units suit you.
  3. Temperature is converted to kelvin internally — absolute zero is the floor.
  4. Select Calculate.
  5. The STP figure lets you sanity-check the result against 22.414 L/mol.

The ideal gas law: PV = nRT

The PV = nRT gas law links four things. In PV = nRT, what is n? The amount of gas in moles. What is R? The gas constant, 8.314 J/(mol·K) in SI units. P is pressure and V is volume, with temperature T always in kelvin. This page works as a calculator for ideal gas law problems in any of those units.

PV = nRT

P = pressure (Pa), V = volume (m³), n = moles, R = 8.314462618 J/(mol·K), T = temperature (K)

Rearranged for each variable:

V = nRT ÷ P       P = nRT ÷ V

n = PV ÷ RT      T = PV ÷ nR

Worked example

What volume does 2 moles of gas occupy at 25 °C and 1 atm?

Convert first: T = 25 + 273.15 = 298.15 K, and P = 101,325 Pa.

V = (2 × 8.314462618 × 298.15) ÷ 101,325 = 0.04893 m³

48.93 litres

Sanity check: one mole at these conditions occupies about 24.5 L, so two moles giving roughly 49 L is right.

What is R in PV = nRT? Why its value keeps changing in textbooks

R is the same physical constant every time. What changes is the units, and each version carries its own number:

Value of RUnitsUse when pressure is in
8.314462618J/(mol·K)Pascals, volume in m³
0.082057L·atm/(mol·K)Atmospheres, volume in litres
62.364L·mmHg/(mol·K)mmHg (torr), volume in litres
0.083145L·bar/(mol·K)Bar, volume in litres
8.314462618m³·Pa/(mol·K)Identical to the first row

This calculator sidesteps the whole problem. It converts your input to pascals and kelvin, uses the SI value of R, then converts back. You never have to pick the right version of R.

Standard temperature and pressure

STP is a reference point, and unfortunately more than one definition is in circulation. Check which your course uses:

StandardTemperaturePressureMolar volume
IUPAC STP (since 1982)0 °C (273.15 K)1 bar (100 kPa)22.711 L/mol
Older STP0 °C (273.15 K)1 atm (101.325 kPa)22.414 L/mol
SATP (ambient)25 °C (298.15 K)1 bar24.790 L/mol

The familiar 22.4 litres per mole comes from the older 1 atm definition and is still what most school syllabuses teach. IUPAC changed the reference to 1 bar in 1982, which gives 22.7 L/mol. Both are correct for their own definition, so state which one you used.

Boyle’s law, Charles’s law formula and Gay-Lussac law formula

Boyle, Charles and Gay-Lussac each found one slice of PV = nRT by holding something constant:

  • Boyle's law — fix temperature and amount: P₁V₁ = P₂V₂. Squeeze a gas and the pressure rises.
  • Charles's law — fix pressure and amount: V₁/T₁ = V₂/T₂. Heat a gas and it expands.
  • Gay-Lussac's law — fix volume and amount: P₁/T₁ = P₂/T₂. Heat a sealed container and pressure climbs.
  • Avogadro's law — fix pressure and temperature: V₁/n₁ = V₂/n₂. Equal volumes hold equal numbers of molecules.
  • Combined gas law — fix only the amount: P₁V₁/T₁ = P₂V₂/T₂.

Every one of these needs absolute temperature. Using Celsius breaks them, because doubling from 10 °C to 20 °C is not doubling the temperature — it is going from 283 K to 293 K, a rise of under 4%.

When the ideal gas law stops working

It assumes gas molecules take up no space and do not attract one another. Both assumptions hold well at everyday conditions and fail when molecules get crowded:

  • High pressure — above roughly 10 atm the molecules' own volume stops being negligible.
  • Low temperature — near the condensation point, intermolecular attraction dominates.
  • Polar or large molecules — water vapour and ammonia deviate more than helium or argon.

Near those limits, chemists switch to the van der Waals equation or another real-gas model, which adds correction terms for molecular volume and attraction.

To find the number of moles from a mass, use the molar mass calculator.

Combined gas law formula

When the amount of gas stays the same but pressure, volume and temperature all change, use the combined gas law:

P₁V₁ ÷ T₁ = P₂V₂ ÷ T₂

Here 1 means "before" and 2 means "after". Temperatures must be in kelvin.

Worked example

A balloon holds 2.0 L at 1.0 atm and 300 K. It rises to 0.8 atm and cools to 270 K.

V₂ = P₁V₁T₂ ÷ (T₁P₂) = 1.0 × 2.0 × 270 ÷ (300 × 0.8).

V₂ = 540 ÷ 240 = 2.25 L

Molar volume of a gas

One mole of an ideal gas takes up the same volume whatever the gas is — it depends only on temperature and pressure.

  • 22.41 L at 0 °C and 1 atm (the classic STP).
  • 22.71 L at 0 °C and 100 kPa (the current IUPAC standard).
  • 24.47 L at 25 °C and 1 atm (room conditions).

Density of a gas formula

Rearrange PV = nRT using n = mass ÷ molar mass:

Density ρ = P × M ÷ (R × T)

Dry air (M ≈ 28.97 g/mol) at 1 atm and 293 K: ρ = 1 × 28.97 ÷ (0.08206 × 293) = 1.20 g/L. Need M for a compound? Use the molar mass calculator.

How to calculate specific gravity

Specific gravity compares a substance’s density with a reference. For liquids and solids the reference is water (1.000 g/cm³ at 4 °C). For gases it is usually air.

Specific gravity = density of substance ÷ density of reference

Olive oil at 0.91 g/cm³ has a specific gravity of 0.91, so it floats on water. For a gas, divide its molar mass by air’s (about 28.97 g/mol): natural gas, mostly methane at 16.04 g/mol, has a specific gravity of about 0.55 — which is why it rises.

Other ways to use this calculator

The ideal gas law answers many gas questions.

  • Ideal gas law calculator and solver — solve PV = nRT for pressure, volume, temperature or moles.
  • Ideal gas equation calculator — units for pressure and temperature are converted for you.
  • Combined gas law solver — use the before-and-after formula above when the amount of gas is fixed.
  • PV nRT calculator — solve for any one of pressure, volume, moles or temperature.
  • Gas laws — Boyle’s, Charles’s and Gay-Lussac’s laws are all special cases of the same equation.
  • STP volume — one mole of an ideal gas fills 22.4 L at 0 °C and 1 atm.
  • Combined gas law calculator — use the combined gas law formula above when the amount of gas stays the same.

Frequently asked questions

The ideal gas law is PV = nRT, linking pressure, volume, moles and temperature through the gas constant R. It describes how a gas responds when you change any one of those. Two moles at 25 °C and 1 atm occupy about 48.9 litres. Temperature must be absolute — kelvin, not Celsius — or the equation gives nonsense.

R is 8.314462618 J/(mol·K) in SI units, an exact value since the 2019 SI redefinition. Textbooks quote other numbers because they use other units: 0.082057 L·atm/(mol·K) for atmospheres and litres, or 62.364 L·mmHg/(mol·K) for torr. It is the same constant throughout — only the units differ. This calculator converts to SI internally so you never have to choose.

STP means standard temperature and pressure, but two definitions are in use. IUPAC has defined it as 0 °C and 1 bar since 1982, giving a molar volume of 22.711 L/mol. The older definition used 0 °C and 1 atm, giving the familiar 22.414 L/mol that most school courses still teach. Say which one you used when quoting a result.

At high pressure and low temperature. The law assumes molecules occupy no volume and do not attract each other, which holds well in ordinary conditions. Above roughly 10 atmospheres the molecules' own size matters, and near the condensation point attraction takes over. Large or polar molecules like water vapour deviate more than small ones like helium. Real-gas models such as van der Waals handle those cases.

P₁V₁/T₁ = P₂V₂/T₂, with temperature in kelvin. It links the before and after states of a fixed amount of gas when pressure, volume and temperature all change.

Sources and further reading

  1. NIST — Molar gas constant R — the exact CODATA value 8.314462618 J/(mol·K)
  2. IUPAC Gold Book — Standard conditions for gases — the 1982 redefinition of STP to 1 bar
  3. NIST — SI redefinition — why R became an exact constant in 2019