🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
CHEMISTRY

Ideal Gas Law Calculator — solve PV = nRT for any variable

Enter any three of pressure, volume, amount and temperature in the units you actually have, and get the fourth, plus the molar volume and the volume the same gas would occupy at STP.

The box you are solving for is ignored, so leave whatever is in it.
Molar mass is optional. Supply it and the tool also reports the sample mass and the gas density under your conditions.
Volume
0
 
0
Molar volume (L/mol)
0
Volume at STP, 0°C and 100 kPa
0
Sample mass (g)
0
Density (g/L)
Tip: temperature must be absolute. Putting 25 into PV = nRT because the gas is at 25°C understates the answer by a factor of twelve.
Advertisement

The ideal gas law calculator above rearranges PV = nRT for whichever variable you are missing and does the unit conversions on the way in and out. Enter pressure in atmospheres or kilopascals, volume in litres or cubic feet, temperature in kelvin or degrees Celsius, and the tool normalises everything, applies the gas constant in matching units, and converts the answer back into the unit you chose.

Arb Digital builds free calculators for people who need one number and do not want to install anything to get it. This one exists because the equation itself is trivial and the units are where everyone loses time. Nearly every wrong answer in a gas-law problem comes from a Celsius temperature, a pressure in the wrong unit, or an R value borrowed from a different unit system. The tool states which R it used and in which units, so the working can be checked rather than trusted.

What This Ideal Gas Law Calculator Does

Pick the variable you want, fill in the other three, and the headline result is your answer in your chosen unit. The supporting grid adds the molar volume under your specific conditions, the volume the same amount of gas would occupy at standard temperature and pressure, and — if you supply a molar mass — the mass of the sample and its density in grams per litre.

The molar volume figure is the one people underuse. It tells you how much space one mole of any ideal gas takes up at your temperature and pressure, and because it does not depend on which gas you have, it is a fast sanity check on the whole calculation. If it comes out near 24.5 L/mol you are at roughly room conditions. If it comes out at 2 L/mol you are at high pressure, and if it comes out in the hundreds you are near vacuum.

One boundary worth stating: this page relates the four state variables of a single gas sample. It is not a unit converter. If all you need is to move a pressure between bar and psi, or a volume between litres and cubic feet, the pressure converter and the volume converter do that job directly and without the gas law getting involved.

How to Use It

  1. Choose the variable to solve for. That box is ignored, so you do not need to clear it.
  2. Enter the other three with the unit you actually have. There is no need to convert anything by hand first.
  3. Check the temperature unit. Celsius and Fahrenheit are converted to kelvin internally. Absolute zero is the floor and negative kelvin is rejected.
  4. Add a molar mass if you have one. Oxygen is 32.00, nitrogen 28.01, carbon dioxide 44.01. This unlocks the mass and density figures.
  5. Read the sub-line under the answer. It states the R value and the internal units used, so you can reproduce the arithmetic on paper.

The Formula and How It Is Calculated

The ideal gas law is PV = nRT. Rearranged, that gives V = nRT/P, P = nRT/V, n = PV/RT and T = PV/nR. The tool converts every input to atmospheres, litres, moles and kelvin, applies R = 0.082057366 L·atm·mol⁻¹·K⁻¹, then converts the result back to your display unit.

That R value is not independent. It is the CODATA molar gas constant, exactly 8.314462618 J·mol⁻¹·K⁻¹ since the 2019 redefinition of the SI base units, divided by 101,325 Pa per atmosphere and multiplied by 1,000 litres per cubic metre. Every other version you have seen — 62.364 L·mmHg, 0.083145 L·bar, 10.732 ft³·psi·lbmol⁻¹·°R⁻¹ — is that same constant wearing different units, which is exactly why mixing an R from one table with pressures from another goes wrong.

The default example is two moles of oxygen at 1 atm and 300 K. Solving for volume gives V = (2 × 0.082057366 × 300) ÷ 1 = 49.234 L. The molar volume is therefore 24.617 L/mol, and with a molar mass of 32 g/mol the sample weighs 64 g and has a density of 64 ÷ 49.234 = 1.300 g/L. The rearrangements follow the standard treatment of the ideal gas law on Chemistry LibreTexts.

Advertisement

Which STP You Mean Changes the Answer by 1.3 Percent

There is no single standard temperature and pressure, and the two common definitions disagree. The older convention, still printed in many textbooks, is 0°C and 1 atm, which gives a molar volume of 22.414 L/mol. The current IUPAC convention is 0°C and 100 kPa, which is 1 bar rather than 1 atm and gives 22.711 L/mol. The pressures differ by 1.325 percent and so do the volumes.

This tool reports the STP volume on the 100 kPa definition, because that is the one in current use and the one the NIST guidance on SI units is consistent with. If your course or your reference table uses 22.4 L/mol, multiply the tool's STP figure by 1.01325 to move it back to the older basis. The difference is small enough to hide inside rounding and large enough to fail a marked answer.

A third convention adds to the confusion. SATP, standard ambient temperature and pressure, is 25°C and 100 kPa, giving 24.790 L/mol. NTP, normal temperature and pressure, is usually 20°C and 1 atm at 24.055 L/mol. When a datasheet quotes a flow rate in standard litres per minute without saying which standard, the ambiguity is worth several percent, and in gas metering that is real money. Always ask which reference conditions a standard volume is quoted against.

Where the Ideal Gas Law Stops Being True

The law assumes gas particles have no volume of their own and do not attract each other. Both assumptions are good when the gas is dilute and warm, and both fail as the gas is squeezed or cooled. In practice the ideal gas law is accurate to about one percent for common gases at ambient temperature up to a few atmospheres, and it degrades from there.

The two failures pull in opposite directions. Attraction between molecules pulls them together and makes the real volume smaller than the ideal prediction, which dominates at moderate pressure. The finite size of the molecules themselves makes the volume larger than predicted, and that dominates at high pressure once the molecules are packed close. The crossover is why a plot of PV/nRT against pressure dips below one and then climbs above it.

Practical consequences: steam near its condensation point, carbon dioxide in a cylinder, and any gas near its critical point are all badly served by PV = nRT. Ammonia and water vapour deviate more than nitrogen or helium at the same conditions because they hydrogen-bond. If you need better, the van der Waals equation adds a term for molecular attraction and a term for molecular volume, and a compressibility factor Z turns the ideal answer into a corrected one by simple multiplication.

The Combined Gas Law Is This Equation Used Twice

Problems phrased as "a balloon at 20°C and 1 atm is taken to 5°C and 0.8 atm, what is the new volume" do not need a separate formula. Because n and R do not change, PV/T is a constant for that sample, so P₁V₁/T₁ = P₂V₂/T₂. That is the combined gas law, and it is nothing more than the ideal gas law written for two states of the same gas.

Boyle's law, Charles's law and Gay-Lussac's law are the same relationship with one more variable held fixed. Boyle holds temperature constant so PV is constant; Charles holds pressure constant so V/T is constant; Gay-Lussac holds volume constant so P/T is constant. Learning four laws is unnecessary if you can rearrange one. To use this calculator for a two-state problem, solve for n from the first state, then feed that n into the second state with the new pressure and temperature.

The one thing that does not survive the shortcut is a change in the amount of gas. If the balloon leaks, or a reaction produces gas, n changes and the PV/T constant breaks. In those cases go back to the full equation on both sides and keep n explicit.

Reading Density and Molar Mass Out of the Gas Law

Substituting n = m/M into PV = nRT and rearranging gives ρ = PM/RT, where ρ is density and M is molar mass. That single rearrangement is behind a whole class of laboratory measurements: weigh a known volume of an unknown gas at known temperature and pressure, and the molar mass falls out as M = ρRT/P.

It also explains why hot air rises and why helium balloons float, in one line. Density is proportional to molar mass and inversely proportional to temperature, so a gas is buoyant either because its molecules are light or because it is hot. Helium at 4 g/mol is about seven times less dense than air at roughly 29 g/mol under the same conditions. Air heated from 20°C to 100°C loses about a fifth of its density with no change in composition at all. If you need to convert a density between units afterwards, the density converter handles that, and the molar mass calculator supplies M from a formula.

Need a different calculation?

Arb Digital publishes hundreds of free calculators across chemistry, maths, finance and marketing — no sign-up, no limits. If something you need is missing, tell us and we will look at building it.

Browse All Free Tools Suggest a Tool

Common Mistakes to Avoid

  • Using Celsius in the equation — PV = nRT needs absolute temperature. At 25°C the correct figure is 298.15 K, and using 25 gives an answer twelve times too small.
  • Mixing R with the wrong pressure unit — 0.08206 goes with atmospheres, 8.314 with pascals and cubic metres, 0.08314 with bar. Pairing 0.08206 with kilopascals is off by a factor of about a hundred.
  • Assuming 22.4 L/mol always applies — that is the molar volume at 0°C and 1 atm only. At room temperature it is closer to 24.5 L/mol, an eight percent difference.
  • Forgetting gauge versus absolute pressure — a tyre gauge reading 30 psi means 44.7 psi absolute. The gas law needs the absolute value.
  • Applying it to a gas near condensation — steam near 100°C or a refrigerant near its boiling point deviates by far more than the arithmetic error you are worrying about.

Related Free Tools From Arb Digital

Get a molar mass from a formula with the molar mass calculator, then convert between mass and amount using the moles to grams calculator. Change pressure units with the pressure converter, volumes with the volume converter, and temperatures with the temperature converter. For gas-phase reactions the equilibrium constant calculator uses the same R to move between Kc and Kp, and the molarity calculator handles the solution side. The full free online tools hub lists everything else.

Frequently Asked Questions

What is the ideal gas law?

It is the relationship PV = nRT, which links the pressure, volume, amount and absolute temperature of a gas through the gas constant R. It treats gas particles as having no volume and no attraction to one another, which is a good approximation for dilute gases well above their boiling point.

Which R value does this calculator use?

It works internally in atmospheres, litres, moles and kelvin, so it uses R = 0.082057366 L·atm per mol per kelvin. That is the CODATA molar gas constant of 8.314462618 J per mol per kelvin converted into those units.

Do I have to convert temperature to kelvin myself?

No. Choose Celsius or Fahrenheit and the tool converts to kelvin before applying the equation. What you must not do is type a Celsius number and leave the unit set to kelvin, because the arithmetic will run and give a confidently wrong answer.

Why is molar volume 22.4 in my textbook and 22.7 here?

Because there are two definitions of standard temperature and pressure. The older one uses 0°C and 1 atm and gives 22.414 L/mol. The current IUPAC definition uses 0°C and 100 kPa and gives 22.711 L/mol. This tool reports the 100 kPa figure.

When does the ideal gas law fail?

At high pressure and at low temperature, where molecular volume and intermolecular attraction stop being negligible. For common gases at ambient conditions and a few atmospheres it is accurate to roughly one percent, but near condensation or above tens of atmospheres you need a real-gas equation.

Can I get the density of a gas from it?

Yes. Substituting the amount for mass over molar mass gives density equal to PM divided by RT. Enter a molar mass in the optional box and the calculator reports both the sample mass and the density in grams per litre.

Does the ideal gas law depend on which gas it is?

Not in its ideal form. One mole of helium and one mole of carbon dioxide occupy the same volume at the same pressure and temperature. Identity only enters through molar mass, which affects mass and density, and through how badly each gas deviates from ideality.

This calculator is provided for education and general reference. It describes how the ideal gas law is computed and is not laboratory or safety guidance; follow the procedures and risk assessments issued by your own institution.

Advertisement
Advertisement

Take it further