Ideal Gas Law Calculator: PV = nRT
Solve PV = nRT for pressure, volume, moles or temperature in atm, kPa, mmHg, psi, L, m³, K, °C or °F. Units are converted for you and every step is shown.
Ideal Gas Law Calculator
Calculate the relationship between pressure, volume, temperature, and amount of gas using the Ideal Gas Law equation: PV = nRT. This calculator helps solve for any variable when the other three are known.
Select Variable to Solve For
Enter Known Values
Ideal Gas Law Calculator: PV = nRT
The single most common mistake with an ideal gas law calculator is assuming the gas constant R is one fixed number. It is not. R is exactly 8.314462618 J/(mol·K) under the 2019 SI definition, but the value you enter must match the units of your pressure, volume and temperature. Use R = 0.082057 L·atm/(mol·K) when pressure is in atmospheres and volume in liters; use R = 62.364 L·mmHg/(mol·K) when pressure is in torr; use R = 10.731 psi·ft³/(lb-mol·°R) only if you are working in US customary units per pound-mole. Picking R = 8.314 J/(mol·K) while entering pressure in atm and volume in L gives an answer off by a factor of about 101.3. This calculator handles every common unit and selects the correct R internally, so you never have to guess.
- Gas Constant R (SI): 8.314462618 J/(mol·K), exact since 2019 SI redefinition (CODATA 2018/2022, NIST)
- R in L·atm/(mol·K): 0.082057 (derived: 8.314462618 ÷ 101.325)
- R in L·mmHg/(mol·K): 62.3637 (0.082057 × 760)
- R in psi·ft³/(lb-mol·°R): 10.731 (per pound-mole, not gram-mole; a frequent cause of factor‑454 errors)
- STP Molar Volume (IUPAC): 22.710 L/mol at 273.15 K and 1 bar (10⁵ Pa)
- STP Molar Volume (old): 22.414 L/mol at 273.15 K and 1 atm (101,325 Pa)
- Input Units Handled: Pressure: atm, Pa, kPa, bar, mmHg (torr), psi. Volume: L, mL, m³, cm³, gal (US), ft³. Temperature: K, °C, °F
How To Use The Calculator
Select the variable you want to solve for, Pressure, Volume, Moles, or Temperature. Enter the known values for the other three variables. Choose the units for each input; the calculator converts everything to atm, L, mol and K internally. Pick a display option for the gas constant, the choice only changes how R is shown in the steps, never the numerical answer. Set decimal places from 0 to 5. Click Calculate.
The result appears in the unit you selected, with the full value shown in the primary display. Below that, the calculator shows the converted values of all four variables in the standard unit for that variable (atm, L, mol, K) and a list of equivalent values in other common units. If you turned on calculation steps, you see each rearrangement of PV = nRT with the numbers substituted. If you turned on unit conversions, you see the result in every compatible unit.
Input Order and Validation
Enter the three known values in any order. The field for the unknown variable is disabled and cleared automatically. Every pressure, volume and moles input must be a positive number. Temperature must be above absolute zero: below 0 K, and the calculator returns an error. If any input is missing or zero, the calculator alerts you before it runs.
PV = NRT And Its Four Rearrangements
The ideal gas law PV = nRT is an equation of state. It relates pressure P, volume V, amount n (in moles), and absolute temperature T through the molar gas constant R. Solve for any one variable by rearranging:
- P = nRT / V, used when you know the number of moles, the container volume, and the temperature.
- V = nRT / P, used when you know the moles, pressure, and temperature.
- n = PV / RT, used when you know pressure, volume, and temperature.
- T = PV / nR, used when you know pressure, volume, and moles.
These are algebraic rearrangements of the same equation. If you are solving for temperature, you enter pressure in atm, volume in L, moles in mol, and the calculator does T = (P × V) / (n × R) using R = 0.082057 L·atm/(mol·K). The result is in Kelvin, which you can then convert to °C or °F.
Choosing R To Match Your Units
R is the same physical constant regardless of units. The numerical value changes because the units change. The calculator converts all inputs internally to atm, L and K, so it always uses R = 0.082057 L·atm/(mol·K) for the arithmetic. The R display options, 0.082057 L·atm/(mol·K), 8.3145 J/(mol·K), 62.364 L·mmHg/(mol·K), 10.732 psi·ft³/(lb-mol·°R), only affect what you see in the calculation steps.
The 10.731 Value Is Per Pound-Mole
The R option labelled 10.731 psi·ft³/(lb-mol·°R) is correct per pound-mole. If you enter pressure in psi, volume in ft³, and moles in gram-moles (the usual chemistry definition of a mole), the value you need is 0.7302 psi·ft³/(mol·°R), not 10.731. Using 10.731 with gram-moles introduces a factor-of-14.7 error. This calculator uses the pound-mole form only when you select the 10.731 display option; the internal arithmetic is unaffected because the calculator converts all inputs to atm, L and K before computing.
Worked Example: Moles Of Gas In A Tank
A scuba tank has a volume of 12.0 L. The pressure gauge reads 200 bar. The tank is at 25 °C. How many moles of air are in the tank?
Step 1: Convert everything to the calculator's internal units.
- Pressure: 200 bar × (1 atm / 1.01325 bar) = 197.4 atm.
- Volume: 12.0 L (already in liters).
- Temperature: 25 °C + 273.15 = 298.15 K.
Step 2: Use the rearrangement n = PV / RT.
n = (197.4 atm × 12.0 L) / (0.082057 L·atm/(mol·K) × 298.15 K)
n = 2368.8 / 24.468 = 96.8 mol.
Step 3: Interpret the result.
96.8 moles of air. At standard molar volume (about 22.4 L/mol at 1 atm and 0 °C), this would occupy 96.8 × 22.414 = 2170 L, or 2.17 m³. The tank holds that much gas compressed into 12 L.
Failure mode: If you used °C instead of K, you would get T = 25, and n = 2368.8 / (0.082057 × 25) = 2368.8 / 2.051 = 1155 mol, over 10 times too high. Always check that temperature is in Kelvin.
Sanity Checks: Molar Volume And Absolute Temperature
After you get a result, run three quick checks to see if it is physically plausible.
Molar Volume Check
At standard conditions (0 °C, 1 atm), one mole of any ideal gas occupies 22.414 L. At room temperature (20-25 °C) and 1 atm, one mole occupies roughly 24.0-24.5 L. If your calculated volume per mole is far from these numbers, say 50 L/mol at 1 atm, either your pressure is very low, your temperature is very high, or you used the wrong units.
Absolute Temperature Check
If your temperature result is below 0 K, the calculation is wrong because temperature must be in an absolute scale. The calculator rejects T ≤ 0 K. If your temperature result is above about 5000 K, the gas would be a plasma, and the ideal gas law no longer describes it. In practice, the law works well up to about 1000 K for diatomic gases.
Pressure Range Check
Above about 10 atm, real gases deviate from the ideal gas law by more than 1%. If your calculated pressure is above 10 atm and the gas is not monatomic, treat the result as an approximation. For gases like propane or carbon dioxide near their condensation point, the error can be 5% or more even at 1 atm.
| R Value | Unit Set | When To Use | Common Mistake |
|---|---|---|---|
| 0.082057 L·atm/(mol·K) | P in atm, V in L, T in K | General chemistry, high-school and college | Using with P in kPa or bar without converting |
| 62.3637 L·mmHg/(mol·K) | P in mmHg or torr, V in L, T in K | Lab contexts with manometer readings in mmHg | Forgetting 1 atm = 760 mmHg; using 62.36 with atm gives answer off by 760 |
| 8.314462618 J/(mol·K) | P in Pa, V in m³, T in K | Physics and SI-only problems; energy units | Using with L and atm; answer off by ~101.3 |
| 10.731 psi·ft³/(lb-mol·°R) | P in psi, V in ft³, T in °R | US engineering (per pound-mole) | Using 10.731 with gram-moles; factor of 454 error |
| 0.7302 psi·ft³/(mol·°R) | P in psi, V in ft³, T in °R | US engineering (per gram-mole) | Confusing with 10.731 value |
What Often Goes Wrong
The single thing that most often goes wrong is unit mismatch: using a value of R that does not match the units of the inputs. The second is forgetting to convert °C to K. The third is assuming the ideal gas law is exact, it is always an approximation, and the error grows as pressure rises and temperature falls. If your result seems off by a factor of about 10, 100, or 454, you have a unit error. If your result is below absolute zero, you forgot the Kelvin conversion. If your result is physically implausible, a pressure of 0.0001 atm at sea level, a temperature of 10,000 K at room conditions, check that you entered the correct input values and selected the correct variable to solve for. The calculator itself does the arithmetic correctly; the error is almost always in the inputs.
Common Questions
Why must temperature be in Kelvin?
Kelvin is an absolute temperature scale where zero is absolute zero (0 K = -273.15 °C), the point where all molecular motion stops. The ideal gas law PV = nRT is derived from a proportionality that holds only when temperature is measured from this absolute zero. Using Celsius or Fahrenheit adds an offset that makes the ratio PV/nR non-linear and produces a wrong answer. Always convert: K = °C + 273.15, or °R = °F + 459.67.
Which R value should I use?
Use the R value whose units match your pressure, volume and temperature. If your pressure is in atm and volume in L, use R = 0.082057 L·atm/(mol·K). If your pressure is in Pa and volume in m³, use R = 8.314 J/(mol·K). If your pressure is in psi and volume in ft³, and you work in gram-moles, use R = 0.7302 psi·ft³/(mol·°R). If you work in pound-moles, use R = 10.731 psi·ft³/(lb-mol·°R). The calculator handles all common units internally, so you never need to pick an R value; just select the display option that matches your textbook or problem statement.
Can I use this calculator for real gases?
Yes, but with a warning. The ideal gas law is accurate within about 1% for gases like helium, nitrogen, oxygen and air at pressures below 10 atm and temperatures above their boiling point. For gases near their condensation point, such as propane at 0 °C or steam at 100 °C, the error can exceed 5%. For higher accuracy, use an equation of state like van der Waals (P + a(n/V)²)(V - nb) = nRT or the Peng-Robinson equation, which correct for intermolecular attraction (a) and molecular volume (b). The calculator follows the ideal gas law only.
How do I handle gas mixtures?
Use Dalton's law of partial pressures: the total pressure P_total equals the sum of the partial pressures of each gas, and each partial pressure P_i equals the mole fraction X_i times the total pressure. For the ideal gas law, treat each component independently. For example, if air is 21% oxygen and 79% nitrogen by mole fraction, the partial pressure of oxygen is 0.21 × P_total. The total number of moles is the sum of the moles of each gas. The calculator solves for a single gas; for mixtures, sum the moles of each component first.
What is the difference between STP (1 atm) and STP (1 bar)?
The old STP (standard temperature and pressure) was 273.15 K and 1 atm (101,325 Pa). It gave a molar volume of 22.414 L/mol. In 1982, IUPAC redefined STP as 273.15 K and 1 bar (10⁵ Pa), giving a molar volume of 22.710 L/mol, a difference of 1.3%. Many textbooks still use the 22.4 L/mol shortcut without specifying which definition they follow. Always check which standard pressure your problem or exam uses before applying molar volume as a shortcut.