Ideal Gas Law Calculator

Engineering calculator reviewed for preliminary design use · Last updated: March 2026

Solve ideal gas law PV = nRT for any one unknown from the other three: pressure, volume, moles, or temperature. Apply to gas state change calculations, tank sizing, and compressor calculations as a fundamental engineering tool.

What this calculator is used for

The ideal gas law PV = nRT is the most fundamental relation tying together a gas's pressure, volume, amount, and temperature. It is the starting point across process and piping design — sizing gas inventory in tanks, converting between conditions, and evaluating compressor suction and discharge states. This tool solves for any one of P, V, n, or T given the others.

Typical engineering use cases

  • Gas mass, fill, and remaining inventory in tanks and vessels
  • Converting volumes between standard and operating conditions
  • Estimating gas density (ρ = PM/RT)
  • Evaluating compressor and blower suction/discharge states

Equation and methodology

The ideal gas equation of state is:

PV = nRT  (density form: ρ = PM / (RT))

where P is absolute pressure [Pa] (gauge + atmospheric), V the volume [m³], n the amount of substance [mol], R = 8.314 J/(mol·K), and T the absolute temperature [K] (°C + 273.15). M is the molar mass [kg/mol], so mass m = n·M. For real gases, introduce the compressibility factor Z as PV = ZnRT. Between states 1 and 2 the relation PV/T = constant applies for conversion.

Assumptions and limitations

  • Assumes ideal behavior, neglecting intermolecular forces and molecular volume
  • Error grows at high pressure and low temperature (near the critical point)
  • Pressure and temperature must always be absolute (Pa, K)
  • Not applicable to systems with phase change, condensation, or reaction

Design notes

Confusing gauge with absolute pressure, or Celsius with Kelvin, is the most common error — always confirm input units. At high pressure (roughly a few MPa and above) or low temperature, the compressibility factor Z departs significantly from 1, so correct using an equation of state or real-gas charts. For safety-related work such as relief-valve or blowdown calculations, a conservative evaluation including Z correction is recommended.

Worked Example

Given:

  • Nitrogen (M = 0.028 kg/mol) in a V = 5 m³ vessel
  • Pressure P = 500 kPa abs, Temperature T = 350 K
  • R = 8.314 J/(mol·K)

Method: n = P·V/(R·T) = 500000·5/(8.314·350) ≈ 859 mol. Mass m = n·M = 859·0.028.

Result: n ≈ 859 mol → inventory ≈ 24 kg of N₂.

Interpretation: Watch unit consistency — Pa with m³ and the matching R; mixing bar with litres is the classic error that throws the result by orders of magnitude. At 5 bar/350 K nitrogen is near-ideal, but at high pressure or near the saturation line apply a compressibility factor Z (real-gas) or the inventory will be off.

Common Mistakes & Misuse

  • Applying PV = nRT above ~10 bar or near the dew point without a compressibility factor Z — real gases deviate and Z·nRT is needed.
  • Entering temperature in °C or pressure in gauge — the law requires absolute kelvin and absolute pressure throughout.
  • Mismatching the gas constant to the units (8.314 J/mol·K vs 8.314 kPa·L/mol·K), e.g. mixing bar with Pa or litres with m³.
  • Using mass instead of moles (or the wrong molar mass), which scales the result by the molecular-weight error.

Frequently Asked Questions

When does the ideal gas law fail?

The ideal gas law becomes inaccurate at high pressures (>10 bar), low temperatures (near boiling point), and for large polyatomic molecules. Use van der Waals, Peng-Robinson, or other real-gas equations for these conditions.

What is the value of the gas constant R?

R = 8.314 J/(mol·K) = 8.314 kPa·L/(mol·K). When using different pressure or volume units, ensure R is in consistent units. Common error: mixing bar with Pa or liters with cubic meters.

Related Calculators

Use note
  • Updated: March 2026
  • Intended for preliminary engineering use

For preliminary estimation and educational use only. Results may depend strongly on assumptions, input data, fluid or material properties, and the range of validity of the underlying equation. Verify critical calculations independently and follow the applicable code, specification, and formal engineering review process before using any result for design, procurement, fabrication, operation, or safety decisions.