Ideal Gas Law Calculator

Last Updated: October 20, 2026

Calculate absolute pressure, volume, moles, or temperature using PV = nRT, with unit conversion, optional gas mass and density, and an illustrative comparison with the van der Waals model.

Use absolute pressure and temperature above absolute zero. This solves PV = nRT.

Optional settings

Gas presets add mass, density and an illustrative van der Waals model comparison. They do not establish real-gas accuracy.

Ideal Gas Law Formula

P × V = n × R × T

Rearranged for each variable the calculator can solve:

P = n × R × T / V V = n × R × T / P n = P × V / (R × T) T = P × V / (n × R)
  • P = absolute pressure of the gas (Pa in SI)
  • V = volume the gas occupies (m3 in SI)
  • n = amount of gas (mol)
  • R = universal gas constant, 8.31446 J/(mol·K)
  • T = absolute temperature (K)

The value of R changes with the units you feed it: 8.31446 J/(mol·K) for pascals and cubic meters, 0.082057 L·atm/(mol·K) for liters and atmospheres, and 0.083145 L·bar/(mol·K) for liters and bar. The calculator sidesteps that problem by converting every input to pascals, cubic meters, moles and kelvin, solving with the SI value of R, then converting the answer back into the units you want to read.

What each part of the calculator does:

  • The solve-for selector picks which of the four rearrangements above is used and hides the field for that variable, so only the three knowns stay on screen.
  • Temperature is always converted to kelvin before the math. Entering 25 °C gives 298.15 K, not 25.
  • The amount of gas can be entered as moles or as a mass. Mass is divided by the molar mass to get n, which is what the equation actually needs.
  • Selecting a gas adds molar mass driven outputs: total mass, density in g/L, and molar volume in L/mol.
  • The optional comparison evaluates the van der Waals pressure at the same temperature and molar volume, using the retained approximate gas parameters. Its pressure ratio is model disagreement, not a measured compressibility factor or a verified error bound. Agreement between approximate models does not establish actual gas accuracy or phase stability.

Where PV = nRT Stops Being Accurate

The ideal gas law neglects molecular volume and intermolecular attractions. These approximations become less reliable at high pressure or near phase transitions. The table gives illustrative van der Waals pressure ratios at the ideal molar volume for 1 atm and 25 °C. Critical temperatures are approximate reference values. No universal safe pressure or accuracy limit is established here; use validated property data for the gas and conditions.

Gas Molar mass (g/mol) Critical temp (K) Model ratio at ideal molar volume Validated pressure limit
Helium4.005.21.000917Not established
Hydrogen2.0233.21.000681Not established
Nitrogen28.01126.20.999325Not established
Oxygen32.00154.60.999025Not established
Argon39.95150.90.999076Not established
Methane16.04190.60.997987Not established
Carbon dioxide44.01304.10.995745Not established
Ammonia17.03405.50.994551Not established
Water vapor18.02647.10.992118Not established

Both temperature and pressure affect departures from ideal behavior. The model does not identify condensation or phase equilibrium. Use measured gas-specific compressibility or a validated equation of state when accuracy matters.

The following table describes the optional model pressure ratio. It is not an actual-gas accuracy certification.

Model pressure ratio What it means What to do
0.99 to 1.01Attractions and molecular volume nearly cancelModels nearly agree; actual accuracy unverified
0.95 to 0.99Attractions dominate slightly; real volume is smaller than predictedApproximate model disagreement only
Below 0.95Attractive term lowers model pressure; phase not determinedUse validated property data for the actual gas and conditions
Above 1.05Molecular volume dominates; gas resists compressionExcluded-volume term raises model pressure; verify with property data

Example Problems

Example 1: find the pressure. You have 1.00 mol of air in a 22.4 L vessel at 273.15 K.

  1. Convert the volume to SI: 22.4 L = 0.0224 m3.
  2. Multiply n, R and T: 1.00 × 8.31446 × 273.15 = 2271.1 J.
  3. Divide by volume: P = 2271.1 / 0.0224 = 101,388 Pa.
  4. Convert: 101,388 Pa = 1.0006 atm. The molar volume is 22.4 L/mol and the density of air here is 1.29 g/L. The van der Waals comparison is close to the ideal pressure here, which does not independently verify actual-gas accuracy.

Example 2: find the amount of gas. A 10.0 L cylinder of air sits at 2.00 atm and 300 K.

  1. Convert: 2.00 atm = 202,650 Pa and 10.0 L = 0.0100 m3.
  2. Multiply P by V: 202,650 × 0.0100 = 2026.5 J.
  3. Multiply R by T: 8.31446 × 300 = 2494.3 J/mol.
  4. Divide: n = 2026.5 / 2494.3 = 0.8124 mol. At a molar mass of 28.96 g/mol that is 23.5 g of air, or 4.89 × 1023 molecules.

FAQ

Do I have to convert temperature to kelvin?

Yes. The ideal gas law is built on absolute temperature, where zero means zero molecular kinetic energy. Using 25 instead of 298.15 K makes the answer wrong by a factor of about 12, and using a negative Celsius value produces a negative pressure or volume, which is physically meaningless. Rankine works too if you pair it with an R value in Rankine. The calculator accepts Celsius, Fahrenheit and Rankine and converts them for you.

Which value of R should I use?

Match R to your units. Use 8.31446 J/(mol·K) with pascals and cubic meters, 0.082057 L·atm/(mol·K) with liters and atmospheres, 0.083145 L·bar/(mol·K) with liters and bar, and 62.364 L·torr/(mol·K) with liters and torr. Mixing an R value with the wrong pressure unit is the single most common error on ideal gas problems, and it usually shows up as an answer that is off by a factor of 101,325 or 760.

When should I stop using the ideal gas law?

Use validated real-gas data when the required accuracy cannot be established, especially at high pressure, low temperature or near a phase change. A ratio near 1 between the ideal and van der Waals models is not proof of accuracy. With a validated compressibility factor, PV = ZnRT.

Ideal Gas Law Calculator screenshot