# Gas Density & Compressibility (Z) Calculator

URL: https://hifreetools.com/gas/real-gas

> 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.

## 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

- ρ = P·M / (Z·R·T) Z = P / (ρ·R_specific·T)

## Examples

- Nitrogen at 1 atm and at 200 bar: Nitrogen, 25 °C, 1.01325 bar and 200 bar absolute → 1.145 kg/m³ (Z = 0.9998) and 214.12 kg/m³ (Z = 1.0555)
- Methane at pipeline pressure: Methane, 25 °C, 100 bar absolute → 75.99 kg/m³, Z = 0.852
- Carbon dioxide above its critical point: Carbon dioxide, 25 °C, 100 bar absolute → 817.63 kg/m³, Z = 0.217 (liquid-like; CoolProp phase: supercritical liquid)

## FAQ

**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

- [CoolProp 8.0.0 — open-source thermophysical property library (Bell et al.)](https://coolprop.org/)
- [NIST Chemistry WebBook — Thermophysical Properties of Fluid Systems](https://webbook.nist.gov/chemistry/fluid/)
- [BIPM — The International System of Units (SI Brochure)](https://www.bipm.org/en/publications/si-brochure)

Runs in the browser; nothing is uploaded. Cite as: HIFreeTools, "Gas Density & Compressibility (Z) Calculator", https://hifreetools.com/gas/real-gas
