Ideal Gas Law Calculator
Solve PV = nRT for any variable, in your choice of pressure, volume and temperature units.
Results update as you type.
About this calculator
The ideal gas law ties together the four state variables of a gas in one equation, PV = nRT: pressure times volume equals the number of moles times the gas constant times the absolute temperature. The constant R = 8.314462618 J/(mol·K) in SI units. Rearranged, you can solve for any variable — P = nRT/V, V = nRT/P, n = PV/RT or T = PV/nR — and this calculator does exactly that, converting pressure (Pa, kPa, bar, atm, mmHg, psi), volume (m³, L, mL, cm³) and temperature (K, °C, °F) internally so you can work in whatever units you have.
The classic worked example is one mole of gas at standard temperature and pressure: at 0 °C (273.15 K) and 1 atm, V = nRT/P = 1 × 8.314 × 273.15 / 101,325 ≈ 0.0224 m³, or the familiar 22.4 litres per mole. Heat that gas to 300 K at constant pressure and the volume rises in proportion, since V ∝ T. A crucial detail: temperature must be absolute — always convert °C or °F to kelvin (add 273.15 to °C) before the math, which the calculator handles for you.
The law is called "ideal" because it assumes gas molecules have no volume and do not attract one another. Real gases follow it closely at ordinary pressures and temperatures well above their boiling point, and it is the everyday tool for scuba and diving gas calculations, chemistry stoichiometry of gases, HVAC and pneumatics, and estimating how a balloon or tyre responds to heating and cooling. It becomes less accurate at very high pressure or near condensation, where equations like van der Waals do better.
Frequently asked questions
What is the ideal gas law?
PV = nRT links pressure, volume, moles and temperature of an ideal gas through the constant R = 8.314 J/(mol·K). Rearrange it to solve for any single variable.
What are the correct units?
Internally everything is SI — pascals, cubic metres, moles and kelvin — with R = 8.314. One mole of gas at 0 °C (273.15 K) and 1 atm occupies about 22.4 L (0.0224 m³). Enter any units you like; the calculator converts for you.
Why must temperature be in kelvin?
PV = nRT uses absolute temperature, where 0 K is absolute zero. Celsius and Fahrenheit have arbitrary zeros, so plugging in °C directly gives wrong answers. Add 273.15 to °C to get kelvin — the calculator does this automatically.
What is STP and molar volume?
Standard temperature and pressure is commonly 0 °C and 1 atm, at which one mole of an ideal gas occupies about 22.4 litres. This "molar volume" is a handy check: if your result for one mole near those conditions is far from 22.4 L, recheck the units.
When does the ideal gas law break down?
It is very accurate at moderate pressures and temperatures well above the boiling point, but grows inaccurate at high pressure or near condensation, where molecular volume and attractions matter. Real-gas equations like van der Waals handle those.
How does changing one variable affect the others?
At fixed moles, pressure and volume are inversely related (Boyle’s law), while volume and absolute temperature are directly related (Charles’s law). Heat a sealed rigid container and the pressure rises in proportion to the kelvin temperature.
What value of R should I use?
It depends on units. In SI it is 8.314 J/(mol·K); in litre-atmospheres it is 0.08206 L·atm/(mol·K). This calculator works in SI internally with R = 8.314, so you can enter any units and it reconciles them.
API — use this calculator from code
Call this calculator as a free JSON endpoint — no key required. Send the field values below as query parameters or JSON. Read the full API docs →
Endpoint
GET https://calculator.free/api/v1/ideal-gas-law/
curl
curl "https://calculator.free/api/v1/ideal-gas-law/?solve=volume&pressure=1&pressure_unit=atm&volume=22.4&volume_unit=l&moles=1&temperature=273.15&temperature_unit=k"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/ideal-gas-law/?" + new URLSearchParams({
"solve": "volume",
"pressure": "1",
"pressure_unit": "atm",
"volume": "22.4",
"volume_unit": "l",
"moles": "1",
"temperature": "273.15",
"temperature_unit": "k"
}));
const data = await r.json();
console.log(data.results);
Results are estimates for general guidance only, not financial, medical or tax advice.