Home › Chemistry › Ideal Gas Law Calculator
Ideal Gas Law Calculator
Solves the ideal gas equation PV = nRT for whichever of pressure, volume, amount or temperature is left empty, with pressure in atm, kPa, bar, mmHg or psi and temperature in °C, K or °F.
When to use
You know three of pressure, volume, moles and temperature of a gas and need the fourth, or the molar volume at given conditions.
Do not use when: The gas is near condensation or at very high pressure (use a real-gas equation such as van der Waals), or you need the mass of gas without knowing its molar mass (combine with moles-mass).
Formula
P × V = n × R × T with R = 0.082057366 L·atm/(mol·K) (= 8.314462618 J/(mol·K)); P converted to atm, T to kelvin (K = °C + 273.15)
Ideal-gas behaviour is accurate to about 1% for common gases near room temperature and pressures up to a few atmospheres; deviations grow near the boiling point and above roughly 10 atm.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
pressure | number | no | Gas pressure in the unit given by pressure_unit. Leave empty to solve for it. Range: > 0 | |
pressure_unit | enum: atm | kpa | bar | mmhg | psi | default atm | Unit of the pressure input (1 atm = 101.325 kPa = 1.01325 bar = 760 mmHg = 14.696 psi). | |
volume_l | number | L | no | Gas volume in litres. Leave empty to solve for it. Range: > 0 |
moles | number | mol | no | Amount of gas in moles. Leave empty to solve for it. Range: > 0 |
temperature | number | no | Gas temperature in the unit given by temperature_unit (must be above absolute zero). Leave empty to solve for it. Range: ≥ -459.67, ≤ 10000000 | |
temperature_unit | enum: celsius | kelvin | fahrenheit | default celsius | Unit of the temperature input; the calculation uses kelvin. |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
solved_for | string | pressure, volume_l, moles or temperature. | |
pressure_atm | number | atm | Pressure in standard atmospheres. |
pressure_kpa | number | kPa | Pressure in kilopascals (1 atm = 101.325 kPa). |
pressure_bar | number | bar | Pressure in bar (1 atm = 1.01325 bar). |
volume_l | number | L | Gas volume in litres. |
moles | number | mol | Amount of gas. |
temperature_k | number | K | Absolute temperature. |
temperature_c | number | °C | Temperature in degrees Celsius. |
molar_volume_l_per_mol | number | L/mol | V / n at these conditions (22.414 L/mol at 0 °C and 1 atm). |
Example
Molar volume at 0 °C and 1 atm: {"pressure":1,"pressure_unit":"atm","moles":1,"temperature":0,"temperature_unit":"celsius"} → {"solved_for":"volume_l","volume_l":22.414,"molar_volume_l_per_mol":22.414,"temperature_k":273.15,"pressure_kpa":101.325}
Moles in 5 L at 101.325 kPa and 25 °C: {"pressure":101.325,"pressure_unit":"kpa","volume_l":5,"temperature":25} → {"solved_for":"moles","moles":0.20437,"pressure_atm":1,"temperature_k":298.15,"molar_volume_l_per_mol":24.4654}
GET https://tttkmbb.com/api/v1/calculate/ideal-gas-law?pressure=1&pressure_unit=atm&moles=1&temperature=0&temperature_unit=celsius
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/ideal-gas-law(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/ideal-gas-law · Markdown: https://tttkmbb.com/chemistry/ideal-gas-law.md · JSON definition: https://tttkmbb.com/chemistry/ideal-gas-law.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="ideal-gas-law" - OpenAPI operationId:
solve_ideal_gas_law - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
FAQ
Why is the molar volume 22.414 L and not 22.7 L?
22.414 L/mol applies at 0 °C and 1 atm (101.325 kPa). IUPAC's current STP is 0 °C and 1 bar (100 kPa), which gives 22.711 L/mol; enter pressure 1 bar to reproduce it.
Can I enter temperature in Celsius?
Yes, temperature_unit defaults to celsius and the value is converted to kelvin internally; temperatures at or below absolute zero are rejected.
Related calculators
- Moles to Grams Calculator — Convert the moles of gas to mass or number of molecules.
- Pressure Converter — Pressure expressed in Pa, kPa, bar, psi and atm (or from force and area).
- Temperature Converter — Convert between Celsius, Fahrenheit and kelvin.