All tools Print with PE stamp box Designed for sealed engineering submittals — print drops PE stamp + signature block at the end.

Ideal Gas Law (PV = nRT)

Solve PV = nRT for any one of P, V, n, or T given the other three. Computes density, molar volume, mass, and useful intermediates. Engineering unit systems supported. Compressibility factor Z input for non-ideal gases.

Pa
mol
K
— (Z=1 ideal; high P or low T → Z < 1)
g/mol (or lb/lbmol; air = 29; CO₂ = 44; CH₄ = 16)
Pa
kg/m³
m³/kg
kg

Defaults: 1 m³ of air at sea level (101.325 kPa, 25°C, MW = 29) → 40.9 mol. Ideal gas law is good to ~5% for air, water vapor, and most diatomic gases up to 1 atm. Above 10 atm, use Z-factor or equation of state (Soave, PR, etc.).

$$ PV = Z n R T $$
R values:
  • SI: 8.314 J/(mol·K)
  • US: 10.731 ft³·psia/(lbmol·°R)
  • Common eng: 0.08206 L·atm/(mol·K), 8.205×10⁻⁵ m³·atm/(mol·K)
Density: ρ = PM / (ZRT)
P absolute pressure · V volume · n moles · R universal gas constant · T absolute temperature · Z compressibility factor (1.0 for ideal) · M molecular weight.

When ideal gas applies

Ideal gas assumptions: molecules are points, no intermolecular forces, perfectly elastic collisions. The law works well at low to moderate P and high T compared to critical conditions. Limits:

For natural gas at pipeline pressures, use the Soave-Redlich-Kwong (SRK) or Peng-Robinson equation of state. For steam, use IAPWS-IF97 tables. For air at high pressure, NIST REFPROP.

Z-factor — when to bother

If P/P_c > 0.5 (where P_c is critical pressure of the gas), Z deviates significantly from 1.0. Z is read from generalized compressibility charts (Nelson-Obert) using reduced T (T/T_c) and P (P/P_c). Approximation:

Z ≈ 1 − P_r × ω(T_r) where ω is an empirical function. Or use SRK/PR for accuracy.

For natural gas (mostly methane): Z = 0.95 at 60 psig (typical residential gas main), 0.85 at 1000 psig (pipeline), 0.7 at 5000 psig (compressor outlet).

Common gas reference data

GasMWR (J/kg·K)T_c (K)P_c (bar)
Air (mixture)28.97287132.637.7
Hydrogen (H₂)2.02412433.213.0
Methane (CH₄)16.04518190.646.0
CO₂44.01189304.273.8
Steam (H₂O)18.02461647.3220.5
Nitrogen (N₂)28.01297126.233.9
Oxygen (O₂)32.00260154.650.4

R_specific = R_universal / MW. So for air, R = 8314 / 28.97 = 287 J/(kg·K).

Watch the absolute units

P and T must be absolute. Pressure: gauge + atmospheric (psia = psig + 14.7, kPa(a) = kPa(g) + 101.325). Temperature: K = °C + 273.15, °R = °F + 459.67. Using gauge or Celsius/Fahrenheit gives wrong results.

Reference: Smith, J.M., Van Ness, H.C., Abbott, M.M. (2018). Introduction to Chemical Engineering Thermodynamics, 9th ed., McGraw-Hill, ch. 3. NIST Chemistry WebBook for accurate gas properties.

Related tools

Monthly engineering case studies

One real stormwater or hydraulics design problem per month, with the math worked out and the gotchas called out. No tutorials, no fluff.

Free. Unsubscribe anytime. Privacy.

Engineer of Record — Stamp & Signature
APPLY PE STAMP HERE
Engineer Name
License No.
State
Signature
Date
Project / Sheet
By stamping and signing, the Engineer of Record certifies that the inputs, formulas, and applicability of this calculation have been reviewed for the specific design context. PE-Calc tools provide computational support only — the engineer is responsible for verifying results, applying engineering judgment, and complying with applicable codes and standards.
Calculation generated at pe-calc.com