Gas compressibility factor calculator
Measure how far a real gas strays from ideal behaviour: at 101325 Pa, 273.15 K and 0.022414 m³/mol, Z comes out practically equal to 1. You also see the two products being compared, pressure times volume and R times temperature. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Pressure
- 101,325
- Molar volume
- 0.022414
- Creativity
- 273.15
- Gas constant
- 8.314462618
- Z
- 1.0000013588
- Compressibility factor
- 1.0000013588
- Product pvm
- 2,271.09855
The compressibility factor Z measures how far a real gas departs from ideal-gas behaviour at a given state. For a perfect ideal gas at the same pressure and temperature, Z is exactly one; values below one usually signal attractive forces and volume reduction, while values above one often appear at high pressure where repulsive cores dominate. This calculator accepts absolute pressure, molar volume, and absolute temperature—plus an optional gas constant that defaults to the SI value 8.314462618 joules per mole per kelvin—and returns Z together with the intermediate products P·Vm and R·T so you can check intermediate algebra on homework sheets and lab notebooks. Non-positive temperature is rejected because absolute zero and below make the definition undefined or non-physical.
How the compressibility factor Z is defined
Start from the real-gas equation of state written as P Vm equals Z R T, where P is absolute pressure, Vm is the molar volume of the pure fluid or mixture, R is the universal gas constant, T is absolute temperature in kelvin, and Z is the dimensionless compressibility factor. Rearrangement immediately yields the working definition Z equals P times Vm divided by R times T.
When Z equals one the fluid obeys the ideal-gas law at that state; when Z is less than one the molar volume is smaller than the ideal prediction, and when Z is greater than one the molar volume is larger. In SI units you typically send P in pascals, Vm in cubic metres per mole, T in kelvin, and leave R at the default 8.314462618 joules per mole per kelvin, which produces a pure number for Z.
The tool does not convert Celsius or Fahrenheit to kelvin, does not solve cubic equations of state for an unknown molar volume, does not look up generalized compressibility charts from reduced pressure and temperature, and does not estimate mixture rules beyond the single effective Vm you already measured or computed. Absolute temperature must be strictly positive: T less than or equal to zero is rejected with invalid input instead of returning infinity or a meaningless non-physical factor.
Where compressibility factor calculations show up in real work
Secondary-school and college chemistry courses introduce Z when comparing measured molar volumes of real gases against the ideal-gas prediction at the same pressure and temperature, often for carbon dioxide near condensation or for light gases at elevated pressure. University thermodynamics and process-engineering courses use Z to correct volumetric flow rates, tank inventories, and orifice calculations before students move on to full equations of state or corresponding-states charts. Natural-gas metering, compressor sizing, and pipeline models routinely quote Z at operating pressure and temperature so mass-flow and energy balances stay consistent.
If you later need ideal-gas density from pressure and molar mass, ideal-gas molar volume from RT over P, Boyle or Charles relations without Z, or Kelvin conversion from Celsius, treat those as separate search intents and landings rather than overloading this gas compressibility factor calculator page.
What you can do with it
Homework and lab answer keys
Compute Z = PVm/RT for textbook real-gas states so teachers and auto-graders share one ground truth, including the non-positive temperature rejection.
Process and metering checks
Estimate the compressibility factor from measured absolute pressure, molar volume, and temperature before volumetric flow or tank inventory corrections.
FAQ
What is the compressibility factor Z?
Z = P·Vm/(R·T) is the dimensionless ratio that compares a real gas to the ideal-gas law at the same state.
What happens if temperature is zero or negative?
Absolute temperature must be strictly positive; non-positive T makes Z = PVm/(RT) undefined or non-physical.
Does this solve an equation of state for molar volume?
No. You supply pressure, molar volume, and temperature; the calculator returns Z. Solving cubic EOS models for Vm is a separate intent.
What does it cost?
The browser tool is free and runs locally.
Can I work in atmospheres and litres per mole?
Yes. Enter the gas constant as 0.08205746 L·atm/(mol·K) and keep pressure in atmospheres, molar volume in litres per mole and temperature in kelvin. Without it, the default constant expects pascals and cubic metres per mole.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/chem/compressibility-factor \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"pressure":101325,"molar_volume":0.022414,"temperature":273.15}'const res = await fetch("https://api.kit.forhosting.com/chem/compressibility-factor", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"pressure": 101325,
"molar_volume": 0.022414,
"temperature": 273.15
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/chem/compressibility-factor",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"pressure": 101325,
"molar_volume": 0.022414,
"temperature": 273.15
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/chem/compressibility-factor", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"pressure":101325,"molar_volume":0.022414,"temperature":273.15}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"pressure":101325,"molar_volume":0.022414,"temperature":273.15}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/chem/compressibility-factor", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"pressure": 101325,
"molar_volume": 0.022414,
"temperature": 273.15
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "chem.compressibility_factor",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
By definition Z equals the product of absolute pressure and molar volume divided by the product of the gas constant and absolute temperature: Z equals P times Vm over R times T.
How the compressibility factor Z is defined
Chemistry and process-engineering worksheets often use atmospheres and litres per mole with R equals 0.08205746 litre atmospheres per mole per kelvin; this calculator accepts an explicit gas_constant so those consistent systems work without hidden unit conversion.
What you send and what you get back
Classic textbook checks include an ideal-gas state recovering Z near one, a slightly compressed real gas with Z below one, and explicit R when working in litre-atmosphere units. Send finite numbers under the fields pressure, molar_volume, and temperature. pressure is absolute pressure in any unit consistent with your choice of R; it must be positive. molar_volume is the molar volume of the gas at the state of interest and must be positive—near standard temperature and pressure an ideal gas is about 0.022414 cubic metres per mole or 22.4 litres per mole. temperature is absolute temperature in kelvin and must be greater than zero; zero or negative values fail with a message that names the non-positive temperature rule. gas_constant is optional: when omitted the engine uses 8.314462618 and sets gas_constant_defaulted to true; when provided it must be a finite positive number and gas_constant_defaulted is false. Missing fields, non-numeric strings, NaN, and Infinity fail with invalid_input and are not charged. On success the response echoes cleaned pressure, molar_volume, temperature, and gas_constant, reports Z and the alias compressibility_factor as P·Vm/(R·T), includes product_pvm and product_rt for intermediate checks, reports deviation_from_ideal as Z minus one and ideal_like when the absolute deviation is below one part in a million, states the unit convention for SI, and includes the formula string and method compressibility_factor. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where compressibility factor calculations show up in real work
Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
Curriculum widgets and API fixtures
Drive browser demos and CI golden tests from the same isomorphic solver so classroom tools never disagree with backend grading.
Technical questions
Which units should I use?
Any consistent set works. SI default is P in Pa, Vm in m³/mol, T in K, and R = 8.314462618 J/(mol·K). For L·atm units pass gas_constant = 0.08205746 with matching pressure and molar volume.