The ideal gas law ties together the four things you can measure about a gas sample: its pressure, its volume, how much gas there is and how hot it is. Know three of them and the fourth is fixed. This calculator solves PV = nRT for whichever one you choose, in metric, US or laboratory units, and converts temperatures to kelvin behind the scenes. Enter a molar mass as well and it also gives the mass and density of the gas, which is useful for balloons, gas cylinders and chemistry lab work.
How to use the ideal gas law calculator
- Under Solve for, choose Pressure, Volume, Moles or Temperature.
- Enter the three known quantities:
- Pressure (P), absolute, in Pa, kPa, MPa, bar, mbar, atm, psi, Torr, mmHg or inHg
- Volume (V) in L, mL, m³, cm³, ft³, in³ or US gallons
- Amount of gas (n) in mol, mmol, kmol or lb-mol
- Temperature (T) in °C, °F, K or °R
- Pick the unit of the answer under Show the result in.
- Optionally enter the Molar mass of the gas in g/mol; the help text lists air, N₂, O₂, CO₂ and helium.
- Read the result and its unit conversions alongside the molar volume (V/n), the number of molecules, and the pressure and temperature in other units. “Show the work” includes every conversion to SI.
Ideal gas law formula
With a molar mass M, the gas mass and density follow:
The gas constant is the same number in any consistent set of units. Because 1 J equals 1 kPa·L, the SI value carries straight over to liters and kilopascals:
| R value | Units |
|---|---|
| 8.314462618 | J/(mol·K) = Pa·m³/(mol·K) |
| 8.314462618 | L·kPa/(mol·K) |
| 0.083144626 | L·bar/(mol·K) |
| 0.082057366 | L·atm/(mol·K) |
| 62.363598 | L·Torr/(mol·K) |
| 10.7316 | ft³·psi/(lb-mol·°R) |
Worked example
Molar volume at two "standard" conditions
The default inputs are 1 mol at 0 °C (273.15 K) and 1 atm (101,325 Pa):
V = 1 × 8.314462618 × 273.15 ÷ 101,325 = 0.022414 m³ = 22.414 L
Change the pressure to 100 kPa, the IUPAC standard since 1982, and the answer becomes 22.711 L. The 1.3% gap is why a textbook and a data table can disagree about "STP".
A helium party balloon. Solve for moles with V = 15 L, T = 20 °C, P = 1 atm and a molar mass of 4.0026 g/mol. The balloon holds 0.6236 mol, or 2.50 g of helium at a density of 0.1664 g/L. The same volume of air at 1.204 g/L weighs 18.06 g, so the balloon can lift about 15.6 g minus the weight of its own skin. (Real balloon gas sits slightly above 1 atm, so the true figures differ a little.)
Absolute temperature and absolute pressure
Most mistakes with this law come from the zero points. Heat a sealed, rigid can of air from 20 °C until its pressure doubles, and the gas reaches 2 × 293.15 K = 586.3 K, which is 313.15 °C, not 40 °C. The calculator always converts to kelvin first, and it rejects temperatures at or below absolute zero (−273.15 °C or −459.67 °F) with a message.
Pressure has the same trap. Gauges on tires, compressors and scuba tanks read gauge pressure, the excess over the surrounding air. The law needs absolute pressure, so add the atmospheric pressure (14.696 psi or 101.325 kPa at sea level) before entering the value. Pressure, volume and amount of gas must all be greater than zero.
When real gases deviate
An ideal gas has molecules with no size and no attraction to one another. Real gases come close when the molecules are far apart: at room temperature and atmospheric pressure, air, nitrogen, oxygen and helium follow PV = nRT to within a fraction of a percent, and the calculator’s note puts the usual room-condition error at no more than a few percent. The error grows when:
- Pressure is high. In a 200-bar scuba cylinder the molecules’ own volume matters, and the ideal value is off by a few percent.
- The gas is near condensing. Water vapor, refrigerants, propane and carbon dioxide close to its critical point (31 °C, 73.8 bar) attract each other strongly and occupy less volume than predicted.
- Temperatures are very low. Cooled toward its boiling point, any gas departs from ideal behavior.
Engineers handle these cases with a compressibility factor Z = PV/(nRT), or with equations such as van der Waals that add corrections for molecular size and attraction. For converting the amounts involved, see the grams to moles calculator and the molar mass calculator.
Frequently asked questions
What is the volume of one mole of gas at STP?
It depends on which STP you mean. At 0 °C and 1 atm (101.325 kPa), an ideal gas occupies 22.414 L per mole. At the IUPAC standard of 0 °C and 100 kPa, it is 22.711 L. At 25 °C and 1 atm it grows to about 24.47 L.
Why must temperature be in kelvin?
The ideal gas law relates pressure and volume to absolute temperature, which starts at absolute zero. Celsius and Fahrenheit have arbitrary zeros, so doubling a Celsius reading does not double the gas's energy. The calculator converts °C, °F and °R to kelvin for you and rejects anything at or below 0 K.
Should I enter gauge pressure or absolute pressure?
Absolute pressure. A tire gauge reads pressure above the surrounding atmosphere, so add about 14.7 psi (101.3 kPa) at sea level. A tire at 32 psi gauge is at roughly 46.7 psi absolute.
What value of R does the calculator use?
R = 8.314462618 J/(mol·K), the product of the exact Avogadro and Boltzmann constants defined in the 2019 SI. In other unit systems that is 0.082057366 L·atm/(mol·K) or 62.363598 L·Torr/(mol·K); the calculator converts your units, so you never have to pick a matching R.
How do I find the density of a gas?
Fill in the optional molar mass field. The calculator applies ρ = PM ÷ RT and also reports the gas mass, m = nM. Dry air (28.96 g/mol) at 20 °C and 1 atm comes out at about 1.204 g/L.