Gas Density & Compressibility Factor (Z) Calculator

Choose a gas, a temperature and a pressure to get its density, compressibility factor Z, enthalpy, entropy, internal energy and heat capacities. The values come from CoolProp's reference equations of state (HEOS), with Peng–Robinson and SRK available for comparison, and run entirely in your browser.

Gauge readings add 1 atm (1.01325 bar).

Choose a gas, temperature and pressure, then press Calculate.

Uses the CoolProp 8.0.0 real-fluid engine, which runs in your browser; nothing is uploaded.

22 gases are available here. Acetylene, Nitrogen trifluoride, Hexafluoropropylene, Silane, Germane, Phosphine, and Diborane have no reliable real-gas model in this engine, so they are left out rather than guessed. For their standard volumes and masses use: Gas converter · Batch conversion

Compare models (HEOS, Peng–Robinson, SRK) or a pressure range

For engineers checking model sensitivity. Temperatures here are in kelvin and pressures in absolute pascals.

FreeNo sign-upPrivate — runs in your browser, nothing is uploaded

Quick answer

Gas density at a given temperature and pressure is ρ = P·M / (Z·R·T), where Z is the compressibility factor that corrects the ideal-gas law. Nitrogen at 25 °C is 1.145 kg/m³ at 1 atm (Z = 0.9998) but 214.1 kg/m³ at 200 bar (Z = 1.056); carbon dioxide at 25 °C and 100 bar is a dense, liquid-like fluid of 817.6 kg/m³ (Z = 0.217).

Formula & method

ρ = P·M / (Z·R·T)    Z = P / (ρ·R_specific·T)
  • ρ — density, kg/m³
  • Z — compressibility factor (1 for an ideal gas)
  • P, T — absolute pressure (Pa) and temperature (K)
  • M — molar mass, kg/mol

HEOS evaluates each fluid's reference Helmholtz-energy equation of state (e.g. Span et al. for nitrogen); PR and SRK are cubic equations of state shown for comparison.

Examples

Example 1: Nitrogen at 1 atm and at 200 bar

Input
Nitrogen, 25 °C, 1.01325 bar and 200 bar absolute
Result
1.145 kg/m³ (Z = 0.9998) and 214.12 kg/m³ (Z = 1.0555)
Why
Near atmospheric pressure nitrogen behaves almost ideally. At 200 bar Z is 1.056, so the real density is 5.3% lower than P·M/(R·T) would give.

Example 2: Methane at pipeline pressure

Input
Methane, 25 °C, 100 bar absolute
Result
75.99 kg/m³, Z = 0.852
Why
Methane is more compressible than ideal at this pressure (Z < 1), so it packs 17% denser than the ideal estimate, which matters for CNG storage and pipeline line-pack.

Example 3: Carbon dioxide above its critical pressure

Input
Carbon dioxide, 25 °C, 100 bar absolute
Result
817.63 kg/m³, Z = 0.217 (liquid-like; CoolProp phase: supercritical liquid)
Why
CO₂ above 73.8 bar and near room temperature is far from ideal. The phase line under the results tells you the state, so a liquid-like value is never mistaken for a gas.

When to use this tool

  • Finding the density of a gas at line, tank or cylinder conditions.
  • Checking how far a gas is from ideal (Z) before using PV = nRT.
  • Getting enthalpy or heat capacity for a quick energy balance.

Common mistakes

  • Entering a gauge reading as absolute. Leave the unit on bar (absolute) only if the value is absolute; otherwise choose bar (gauge).
  • Assuming Z ≈ 1 at high pressure. At 200 bar it ranges from about 0.82 (methane) to 1.12 (hydrogen).
  • Reading a two-phase or liquid result as gas. Check the phase shown with the results.

Assumptions

What the result takes for granted:

  • A pure gas at a single, uniform temperature and pressure.
  • Properties are model predictions from CoolProp 8.0.0, which reproduces the reference equations of state used by NIST REFPROP.

Limitations

Where this tool stops — and what to use instead:

  • Seven catalogue gases (acetylene, NF₃, hexafluoropropylene, silane, germane, phosphine, diborane) have no reliable real-gas model in this engine and are left out.
  • No mixtures, flash or phase-envelope calculations.
  • Not a substitute for certified data in safety or custody-transfer work.

Frequently asked questions

What is the compressibility factor Z?

Z = P·V / (n·R·T). It is exactly 1 for an ideal gas; Z > 1 means the gas is harder to compress than ideal (molecules repel), Z < 1 easier (they attract). Real gases approach Z = 1 at low pressure.

How do I calculate gas density at pressure?

Enter the gas, temperature and pressure here. By hand, ρ = P·M / (Z·R·T); with Z from this calculator or a chart. For nitrogen at 25 °C and 100 bar: ρ = 100×10⁵ × 0.0280134 / (1.0041 × 8.3145 × 298.15) = 112.5 kg/m³.

Which model should I use: HEOS, Peng–Robinson or SRK?

HEOS, the default, uses each fluid's high-accuracy reference equation and is the most accurate. Peng–Robinson and SRK are simpler cubic models common in process simulators; compare them in the fold-out to see how much the choice matters.

Why is the first calculation slower?

The property engine (about 9 MB) downloads and is checked against its published hash the first time. After that, results come back instantly and nothing is uploaded.

Why is there no result for some states?

If the engine cannot give a finite, valid answer (for example inside the two-phase region for a gas-only output), the tool shows no number rather than an ideal-gas guess.

Sources & references

External references open in a new tab. We are independent and not affiliated with these organizations.

  • Free
  • No sign-up
  • Runs entirely in your browser — nothing is uploaded.
  • Formula and method shown above

Provided “as is” for general information only — results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.

Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards below.

Related tools

Embed this tool on your site

Free to embed, no sign-up. Paste this code where you want the tool to appear: