Skip to content

Drawing No. EH–GE–006 // General Engineering

Ideal Gas Law Calculator

Reviewed September 2026

Solve PV = nRT for pressure, volume, amount of gas or temperature, then estimate gas mass and density from a selected molar mass.

Scope: Best suited to dilute gases at moderate pressure and temperatures well above condensation. Real-gas effects may be important at high pressure or near phase boundaries.

What this calculator does

Select the unknown variable, enter the other three state variables, and the calculator solves PV = nRT. All calculations are performed internally in SI units. A molar-mass input provides corresponding gas mass and density estimates.

Inputs

Dry air ≈ 28.97; nitrogen 28.01; oxygen 32.00; carbon dioxide 44.01 g/mol.

Results

Enter valid values to calculate.
Solved value—
Absolute temperature—
Gas mass—
Gas density—
Specific volume—
PV / nT check—

Worked example — a cubic metre of air

1 m³ of dry air at standard atmospheric pressure, containing 41.57 mol. Solve for temperature.

Step 1 — rearrange. From PV = nRT:

T = PV / nR = (101 325 × 1) / (41.57 × 8.314463) = 293.16 K = 20.01 °C

Step 2 — mass from moles. Dry air has a mean molar mass of 28.97 g/mol:

m = n · M = 41.57 × 28.97 = 1204.3 g = 1.2043 kg

Step 3 — density and specific volume. In 1 m³, density is numerically the mass: 1.2043 kg/m³, and specific volume is its reciprocal, 0.8304 m³/kg.

That 1.204 kg/m³ is worth committing to memory — it is the figure behind almost every ventilation, fan and duct calculation you will meet. It also shows why the specific gas constant is often more convenient: R/M = 8.3145/0.02897 = 287 J/kg·K for air, letting you write P = ρRT and skip moles entirely.

Knowing when the ideal-gas model is good enough

The ideal-gas law assumes molecules occupy no volume and exert no forces on one another. Real gases deviate, and the deviation is captured by the compressibility factor Z:

PV = ZnRT    (Z = 1 for an ideal gas)

The screening test. Z depends mainly on how far the gas sits from its own critical point, expressed as reduced properties:

Tr = T / Tc    Pr = P / Pc

As a working rule, the ideal-gas law is within about 1% when Pr < 0.1, or when Tr > 2 at moderate pressure. It degrades as you approach the critical point, and fails badly near saturation.

GasTc (K)Pc (bar)At 20 °C, 1 atm
Air132.537.7Tr 2.21, Pr 0.027 — excellent
Nitrogen126.234.0Tr 2.32, Pr 0.030 — excellent
Methane190.646.0Tr 1.54, Pr 0.022 — good
Carbon dioxide304.173.8Tr 0.96 — marginal, check Z
Water vapour647.1220.6Tr 0.45 — use steam tables

Air and nitrogen at ambient conditions are far above their critical temperatures and nowhere near their critical pressures, which is exactly why the ideal-gas law works so well for ventilation and combustion-air work. Carbon dioxide at room temperature is already marginal — its critical temperature is only 31 °C, so at 20 °C it sits below Tc and can condense under pressure. Treating a CO&sub2; cylinder as an ideal gas will mislead you.

Assumptions and where this stops being valid

Single phase, no condensation. The law describes a gas. Once any component starts to condense, it no longer applies to the mixture — which is why moist air at high humidity, refrigerants near saturation and wet steam all need property tables rather than PV = nRT.

Steam is the classic trap. Water vapour near saturation deviates strongly. Use IAPWS-IF97 steam properties, not the ideal-gas law, for anything in a steam cycle. Superheated steam far from saturation behaves more ideally, but the error is rarely worth the convenience.

High pressure. Compressed-air systems at 7–10 bar are still reasonable; gas storage at 200 bar is not. Natural gas custody transfer at pipeline pressure uses AGA-8 or GERG-2008 equations of state precisely because a percent of error is a commercially significant quantity of gas.

Absolute units throughout. T must be in kelvin and P must be absolute, not gauge. Adding 1 bar gauge to a calculation expecting absolute halves the answer at low pressure. This is the most common error on this page, and the calculator reports the kelvin value back specifically so you can check it.

Dry-gas molar mass. 28.97 g/mol is dry air. Humid air is lighter, because water vapour at 18.02 g/mol displaces heavier nitrogen and oxygen — a point that surprises people, and which matters for buoyancy and for fan mass-flow at high humidity.

It says nothing about energy. PV = nRT relates state properties only. Heating, compression work and enthalpy changes need specific heats, and for real gases those vary with temperature and pressure too.

Standards and what to do next

The constant itself: R = 8.314462618 J/mol·K, fixed exactly by the 2019 SI redefinition, since the kelvin is now defined through the Boltzmann constant. The calculator's back-check returns this value as a consistency test on your inputs.

Real-gas properties: NIST Reference Fluid Thermodynamic and Transport Properties (REFPROP) and the NIST Chemistry WebBook are the usual sources for Z and for full equation-of-state data. IAPWS-IF97 for water and steam. AGA Report No. 8 and ISO 12213 for natural gas compressibility; ISO 6976 for calorific value and relative density.

Standard conditions are not universal. “Normal” (0 °C, 101.325 kPa) and “standard” (commonly 15 °C or 20 °C) differ by several percent in molar volume. Nm³ and Sm³ are not interchangeable, and a flow meter reading in one while a contract is written in the other is a real and expensive ambiguity. State which basis you are using.

Next steps: calculate Tr and Pr for your actual conditions before trusting the result. If either is near the critical point, look up Z and use PV = ZnRT. For water, refrigerants or any two-phase possibility, go to property tables directly. And if the result feeds a mass-flow or sizing calculation, confirm whether your standard volumetric basis matches everyone else's.

When the ideal-gas model works

The model is generally most useful at low to moderate gas density, where intermolecular forces and molecular volume have limited influence. Engineering screening calculations for air, nitrogen, oxygen, and similar gases near ambient conditions are typical applications.

Common mistakes

  • Using gauge pressure instead of absolute pressure.
  • Using °C or °F directly in the equation.
  • Applying the model near condensation or at very high pressure.
  • Mixing litres, cubic metres, mol, and kmol without conversion.