Ideal Gas Law Calculator

Calculate pressure, volume, moles, or temperature using PV = nRT

What Is the Ideal Gas Law?

The ideal gas law (PV = nRT) relates the four properties of a gas—pressure, volume, temperature, and amount—through a single equation. It's one of the most important relationships in chemistry and physics, allowing prediction of gas behavior under various conditions.

VariableSymbolCommon UnitsSI Units
PressurePatm, mmHg, torr, psiPa (N/m²)
VolumeVL, mL
Amountnmolmol
TemperatureT°C (convert!)K (Kelvin)
Gas constantR0.0821 L·atm/(mol·K)8.314 J/(mol·K)

Ideal Gas Law

PV = nRT

Where:

  • P= Pressure
  • V= Volume
  • n= Number of moles
  • R= Universal gas constant
  • T= Absolute temperature (Kelvin)

Values of the Gas Constant R

The gas constant R has different numerical values depending on the units used. Choose R to match your pressure and volume units.

R ValueUnitsWhen to Use
0.08206L·atm/(mol·K)P in atm, V in L (most common)
8.314J/(mol·K) or L·kPa/(mol·K)SI units or P in kPa
62.36L·mmHg/(mol·K) or L·torr/(mol·K)P in mmHg or torr
1.987cal/(mol·K)Energy calculations in calories
8.314×10⁻³L·bar/(mol·K)P in bar

Critical: Always use Kelvin for temperature! K = °C + 273.15

Related Gas Laws (Special Cases)

The ideal gas law encompasses several earlier gas laws, which are special cases when certain variables are held constant.

LawFormulaHeld ConstantRelationship
Boyle's LawP₁V₁ = P₂V₂n, TP ∝ 1/V
Charles's LawV₁/T₁ = V₂/T₂n, PV ∝ T
Gay-Lussac's LawP₁/T₁ = P₂/T₂n, VP ∝ T
Avogadro's LawV₁/n₁ = V₂/n₂P, TV ∝ n
Combined Gas LawP₁V₁/T₁ = P₂V₂/T₂nCombines Boyle + Charles

Combined Gas Law

(P₁V₁)/T₁ = (P₂V₂)/T₂

Where:

  • P₁, V₁, T₁= Initial pressure, volume, temperature
  • P₂, V₂, T₂= Final pressure, volume, temperature

Standard Temperature and Pressure (STP)

STP provides standard reference conditions for comparing gas volumes. At STP, one mole of any ideal gas occupies 22.4 liters.

StandardTemperaturePressureMolar Volume
STP (old/common)273.15 K (0°C)1 atm (101.325 kPa)22.414 L/mol
SATP (newer)298.15 K (25°C)1 bar (100 kPa)24.79 L/mol
NTP293.15 K (20°C)1 atm24.04 L/mol

Quick conversions at STP: n = V/22.4 (moles from liters), V = 22.4n (liters from moles)

Density and Molar Mass of Gases

The ideal gas law can be rearranged to calculate gas density and molar mass.

To FindFormulaDerivation
Density (ρ)ρ = PM / RTFrom PV = nRT and n = m/M
Molar mass (M)M = ρRT / PRearranged density formula
Molar massM = mRT / PVUsing mass directly

Gas Density Formula

ρ = PM / RT or M = ρRT / P

Where:

  • ρ= Density (g/L or kg/m³)
  • M= Molar mass (g/mol)
  • P= Pressure
  • R= Gas constant
  • T= Temperature (K)

Real Gases vs Ideal Gases

Real gases deviate from ideal behavior at high pressures and low temperatures. The van der Waals equation accounts for these deviations.

ConditionIdeal Gas AssumptionReal Gas RealityEffect
High pressureMolecules have no volumeMolecules occupy spaceV observed > V predicted
Low temperatureNo intermolecular forcesAttractive forces existP observed < P predicted
Near condensationGas phase onlyPhase change possibleIdeal law fails

Van der Waals equation: (P + an²/V²)(V - nb) = nRT, where a and b are gas-specific constants.

When ideal is good enough: Low pressure (< 5 atm), high temperature (> 0°C), non-polar gases, approximate calculations.

Applications of the Ideal Gas Law

The ideal gas law has widespread applications in science, engineering, and everyday life.

ApplicationHow It's UsedExample
Weather forecastingRelate P, V, T changesPredict storm pressure changes
Scuba divingTank pressure at depthCalculate air supply duration
AutomotiveTire pressure with temperatureTPMS warnings in cold weather
Industrial processesGas storage, compressionNatural gas transport
Respiratory medicineLung volumes, oxygen deliveryVentilator settings
Chemical synthesisGas stoichiometryCalculate reactant volumes

Worked Examples

Calculate Volume of a Gas

Problem:

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

Solution Steps:

  1. 1Identify variables: n = 2.5 mol, T = 25°C = 298 K, P = 1 atm, R = 0.0821 L·atm/(mol·K)
  2. 2Rearrange for V: V = nRT/P
  3. 3Substitute: V = (2.5 × 0.0821 × 298) / 1
  4. 4Calculate: V = 61.2 L

Result:

The oxygen gas occupies 61.2 liters. Compare to STP: at 0°C it would be 2.5 × 22.4 = 56 L—slightly less due to lower temperature.

Calculate Moles from Gas Properties

Problem:

How many moles of gas are in a 5.0 L container at 750 mmHg and 30°C?

Solution Steps:

  1. 1Convert units: T = 30 + 273 = 303 K; R = 62.36 L·mmHg/(mol·K)
  2. 2Rearrange for n: n = PV/RT
  3. 3Substitute: n = (750 × 5.0) / (62.36 × 303)
  4. 4Calculate: n = 3750 / 18895 = 0.198 mol

Result:

There are 0.198 moles (about 0.2 mol) of gas in the container. This is independent of what gas it is—all ideal gases behave the same.

Calculate Molar Mass from Density

Problem:

An unknown gas has a density of 1.96 g/L at STP. What is its molar mass?

Solution Steps:

  1. 1At STP: T = 273 K, P = 1 atm, R = 0.0821 L·atm/(mol·K)
  2. 2Use formula: M = ρRT/P
  3. 3Substitute: M = (1.96 × 0.0821 × 273) / 1
  4. 4Calculate: M = 43.9 g/mol

Result:

Molar mass ≈ 44 g/mol. This matches CO₂ (44.01 g/mol) or C₃H₈ propane (44.10 g/mol). Additional tests would identify the specific gas.

Tips & Best Practices

  • Always convert temperature to Kelvin: K = °C + 273.15 (or approximately +273).
  • Match your R value to your pressure and volume units—this is the most common error source.
  • At STP (0°C, 1 atm), one mole of any ideal gas occupies 22.4 liters.
  • For gas mixtures, apply the ideal gas law to total moles for total pressure.
  • The combined gas law (P₁V₁/T₁ = P₂V₂/T₂) is useful when n is constant.
  • Gas density = PM/RT; use this to find molar mass of unknown gases.
  • Real gases deviate most at high P and low T—use van der Waals for precision.

Frequently Asked Questions

The ideal gas law requires absolute temperature because gas properties are proportional to molecular kinetic energy, which is proportional to absolute temperature. At 0°C, gases still have kinetic energy; only at 0 K (absolute zero) would they theoretically stop moving. Using Celsius would give negative temperatures where the math fails.
This is Avogadro's hypothesis: equal volumes of gases at the same T and P contain equal numbers of molecules. The molar volume (22.4 L at STP) depends only on T and P, not on the type of gas—because ideal gases are assumed to have no volume themselves and no intermolecular forces.
The ideal gas law fails when: (1) pressure is very high (molecules are close together, volume matters), (2) temperature is very low (intermolecular attractions become significant), (3) the gas is near its condensation point, (4) the gas is polar or has strong intermolecular forces. Use the van der Waals equation for these conditions.
Match R's units to your other variables: use R = 0.0821 L·atm/(mol·K) for P in atm and V in L; R = 8.314 J/(mol·K) for SI units; R = 62.36 L·mmHg/(mol·K) for P in mmHg. The numerical answer will be correct only if all units are consistent.
Yes! For mixtures, use total moles (n_total) to find total pressure, or use Dalton's Law: each gas exerts partial pressure as if alone. P_total = P₁ + P₂ + ... For each component: P_i = (n_i/n_total) × P_total = mole fraction × P_total.
Z = PV/(nRT) measures deviation from ideal behavior. For an ideal gas, Z = 1 exactly. Z > 1 means the gas is less compressible than ideal (repulsion dominates); Z < 1 means more compressible (attraction dominates). Real gases have Z ≈ 1 at moderate conditions.

Sources & References

Last updated: 2026-01-22