Ideal Gas Law Calculator
Ideal gas law calculator: solve PV = nRT for pressure, volume, moles or temperature in atm, kPa, bar, mmHg, psi, L, m3, K, C or F, with mass.
Published
Last updated
How the Ideal Gas Law Calculator Formula Works
The ideal gas law says the pressure of a gas times its volume equals the amount of gas times a constant times its absolute temperature. If you know three of pressure, volume, amount and temperature, the fourth follows by rearranging the equation. The constant R is the same for every gas and is 8.31446261815324 joules per mole kelvin, an exact value since the 2019 SI redefinition.
The calculator first converts every entry to pascals, cubic metres, kelvin and moles. Temperatures in Celsius or Fahrenheit become kelvin, because the law needs an absolute temperature. If you enter a mass, it is divided by the molar mass to get moles, n = m / M, and the mass and density are reported back in the results.
Once the unknown is solved, the answer is shown in the unit you picked, and the whole result is also shown in every pressure, volume and temperature unit, so you can read it as atmospheres, kilopascals, bar, millimetres of mercury or pounds per square inch.
P V = n R T; P = nRT / V; V = nRT / P; n = PV / (RT); T = PV / (nR); R = 8.31446261815324 J/(mol K); n = m / M- Patm, kPa, bar, mmHg or psiAbsolute pressure of the gas.
- VL, m3 or mLVolume the gas occupies.
- nmolAmount of gas, or mass divided by molar mass.
- TK, C or FTemperature, converted to kelvin.
- RJ/(mol K)Gas constant, 8.31446261815324.
- + 1 more input below
- P
- atm, kPa, bar, mmHg or psi
- Absolute pressure of the gas.
- V
- L, m3 or mL
- Volume the gas occupies.
- n
- mol
- Amount of gas, or mass divided by molar mass.
- T
- K, C or F
- Temperature, converted to kelvin.
- R
- J/(mol K)
- Gas constant, 8.31446261815324.
- M
- g/mol
- Molar mass, used only when the amount is a mass.
Using the Ideal Gas Law Calculator
Enter solve for
Choose from Pressure (P), Volume (V), Temperature (T), Amount of gas (n).
Enter pressure, absolute (ignored when solving for pressure)
Type the figure you already have, then press Calculate.
Enter pressure unit
Choose from atm, kPa, bar, mmHg, psi.
Enter volume (ignored when solving for volume)
Type the figure you already have, then press Calculate.
Enter volume unit
Choose from litres (L), cubic metres (m3), millilitres (mL).
Enter temperature (ignored when solving for temperature)
Type the figure you already have, then press Calculate.
Enter temperature unit
Choose from kelvin (K), Celsius (C), Fahrenheit (F).
Enter enter the amount of gas as
Choose from Moles, Mass and molar mass.
Enter amount of gas (moles, ignored when solving for amount)
Type the figure you already have, then press Calculate.
Enter mass of gas (grams, ignored when solving for amount)
Type the figure you already have, then press Calculate.
Enter molar mass (grams per mole)
Type the figure you already have, then press Calculate.
Read the result
Press Calculate to update the result. Until you do, the last result is dimmed and marked as out of date, so you always know which numbers belong to the values in the boxes.
A Real Worked Example
Find the volume of 1 mole of gas at 0 C and 1 atm. Solve for volume, enter 1 atm, 1 mole and 0 C, which is 273.15 K. V = nRT / P = 1 × 8.31446 × 273.15 / 101,325 = 0.022414 cubic metres, which is 22.414 litres.
This is the classic molar volume of a gas at 0 C and 1 atm. The same pressure reads 101.325 kPa, 760 mmHg and 14.696 psi.
Pressure of 2 mol in 10 L at 25 C
Solve for pressure with 2 moles in a 10 litre container at 25 C, 298.15 K, and ask for kPa. P = nRT / V = 2 × 8.31446 × 298.15 / 0.010 = 495,791 pascals.
That is 495.8 kPa, 4.893 atm or 71.9 psi absolute. A gauge would read about one atmosphere less.
Moles and mass of air in 5 L
Choose amount, switch the amount to mass and enter 28.96 g per mole for dry air, 5 L, 20 C and 1 atm. n = PV / RT = 101,325 × 0.005 / (8.31446 × 293.15) = 0.2079 mol.
The mass is 6.020 g, so the density is 1.2039 g per L. The published density of dry air at 20 C is 1.2041 kg per cubic metre, a very close match.
Temperature of 0.4 mol at 2 atm in 5 L
Solve for temperature with 2 atm, 5 L and 0.4 mol, and ask for Celsius. T = PV / (nR) = 202,650 × 0.005 / (0.4 × 8.31446) = 304.66 K.
Subtracting 273.15 gives 31.51 C, which is 88.73 F.
Volume of 16 g of oxygen at 1 bar and 300 K
Switch the amount to mass: 16 g of oxygen with a molar mass of 31.998 g per mole is 0.5000 mol. Solve for volume at 1 bar and 300 K.
V = nRT / P = 0.5000 × 8.31446 × 300 / 100,000 = 12.472 litres. The calculator also reports the density, 1.2828 g per L.
Pressure in psi of 1.5 mol in 10 L at 77 F
Solve for pressure, enter 1.5 mol, 10 L and 77 F, and choose psi. 77 F is 25 C, 298.15 K. P = nRT / V = 1.5 × 8.31446 × 298.15 / 0.010 = 371,844 Pa.
That is 53.93 psi, 3.670 atm or 371.8 kPa, all absolute.
What Else to Know
What the Ideal Gas Law Says and How to Calculate PV = nRT
The ideal gas law is PV = nRT. P is the absolute pressure, V is the volume, n is the amount of gas in moles, T is the absolute temperature in kelvin and R is the gas constant. It ties four measurable quantities together, so any one can be found from the other three.

To calculate it by hand, choose the unknown and rearrange. Pressure is P = nRT / V, volume is V = nRT / P, temperature is T = PV / (nR) and amount is n = PV / (RT). Put every value in matching units, multiply and divide, and check that the units cancel.
The calculator does the unit work for you. Choose what to solve for, enter the other three values with their units, and read the answer in the unit you picked. The same result is also shown in every other pressure, volume and temperature unit.

The Gas Constant R and Which Value to Use
R is the same for every ideal gas. Since the 2019 redefinition of the SI it is exactly the Avogadro constant times the Boltzmann constant, 8.31446261815324 joules per mole kelvin, and NIST lists it as 8.314 462 618 J per mole kelvin. The calculator uses the full value.
The number changes with the units of pressure and volume. In litres and atmospheres it is 0.0820574, in litres and kilopascals it is 8.31446, in litres and bar it is 0.0831446. The gas constant table lists them. To find R from measurements, rearrange to R = PV / (nT): one mole at 273.15 K and 1 atm fills 22.414 L, so R = 22.414 / 273.15 = 0.08206 L atm per mole kelvin.

Mixing a value of R in one unit system with pressure or volume in another is the most common reason a hand calculation is off by 100 or 1,000. Converting everything to SI avoids it.
Units, Absolute Pressure and Kelvin
Pressure must be absolute, not gauge. A gauge shows the pressure above the surrounding air, so add about 1 atm, 101.325 kPa or 14.696 psi before using it. The calculator accepts atm, kPa, bar, mmHg and psi, converting through pascals with 1 atm equal to exactly 101,325 Pa. It treats mmHg as the torr, so 760 mmHg is exactly 1 atm.
Temperature must be absolute too. Celsius becomes kelvin by adding 273.15, and Fahrenheit by subtracting 32, multiplying by 5/9 and adding 273.15. Zero kelvin is the lowest possible temperature, so the calculator rejects anything at or below it.
Volume can be litres, cubic metres or millilitres. One cubic metre is 1,000 litres. The molar volume table shows what one mole occupies under common reference conditions such as 0 C and 1 atm, 22.414 L, or 25 C and 1 bar, 24.789 L.

Using Mass and Molar Mass, Density and Specific Volume
Most real problems give grams, not moles. Switch the amount to mass, enter the molar mass in grams per mole and the calculator uses n = m / M. When you solve for the amount, it reports both the moles and the mass, together with the gas density in grams per litre.
Density at a given pressure and temperature is rho = PM / (RT). For dry air, M is about 28.96 g per mole, which gives 1.204 g per litre at 20 C and 1 atm. Specific volume is the reciprocal, volume per unit mass. The mass form of the law, PV = mRT, uses a specific gas constant equal to R divided by the molar mass, about 287.1 J per kilogram kelvin for air.

The gas density table lists molar mass and density for ten common gases at 25 C and 1 atm. Molar masses come from conventional atomic weights, such as 1.008 for hydrogen, 12.011 for carbon, 14.007 for nitrogen and 15.999 for oxygen.
Temperature Change, the Combined Gas Law and the Five Gas Laws
The ideal gas law contains the older gas laws. Hold the amount and temperature fixed and it becomes Boyle's law, P1V1 = P2V2. Hold the amount and pressure and it becomes Charles's law, V1/T1 = V2/T2. Hold the amount and volume and it becomes Gay-Lussac's law, P1/T1 = P2/T2. Avogadro's law, V1/n1 = V2/n2, fixes pressure and temperature. Together they give the combined gas law, P1V1/T1 = P2V2/T2.

To find what a change in temperature does, solve for the state before, then re-solve for the state after with the same amount. For a rigid container, pressure scales with the kelvin temperature, so a container at 1 atm and 20 C reaches 129.0 kPa at 100 C. The heated container table lists more cases.

Never treat these figures as permission to heat a sealed vessel. Pressure rises quickly, and containers have ratings that must not be exceeded.
When the Ideal Gas Law Works and When It Does Not
An ideal gas has point-like particles with no attraction between them. Real gases behave that way when the pressure is low and the temperature is well above the boiling point, because the molecules are far apart. Air, nitrogen, oxygen, argon and helium at room conditions are close to ideal.
The approximation weakens at high pressure, where molecule size matters, and near condensation, where attractions matter. Water vapour, ammonia and carbon dioxide near their liquid points deviate more. For those cases a real gas equation of state, such as van der Waals, or a compressibility factor, is more accurate.

As a rule of thumb, treat results as good to a percent or so near one atmosphere and room temperature, and as rougher estimates at tens of atmospheres. The calculator uses the ideal law only.
Limits of the Estimate and Related Calculators
The results are an estimate for education and planning. They assume an ideal gas, a uniform temperature and a steady state, and they do not include moisture, gas mixtures that react, leaks or vessel flexing. For compressed gas cylinders, boilers or anything under pressure, follow the manufacturer's rating, the safety data sheet and local rules, and have a qualified person check the design.

For converting temperature scales, use the temperature converter. To work out how much a quantity changed in percent, see the percentage calculator, and to estimate a value between two table entries, try the linear interpolation calculator.
Reference Tables
| Symbol | Quantity | SI unit | Units in the calculator |
|---|---|---|---|
| P | Absolute pressure | pascal (Pa) | atm, kPa, bar, mmHg, psi |
| V | Volume of the gas | cubic metre (m3) | L, m3, mL |
| n | Amount of gas | mole (mol) | mol, or grams with a molar mass |
| T | Absolute temperature | kelvin (K) | K, C, F |
| R | Gas constant | J per mole kelvin | Fixed at 8.31446261815324 |
| Pressure and volume units | Value of R | Full unit |
|---|---|---|
| Pa and m3 | 8.314463 | J per mole kelvin, or Pa m3 per mole kelvin |
| kPa and L | 8.314463 | L kPa per mole kelvin |
| bar and L | 0.0831446 | L bar per mole kelvin |
| atm and L | 0.0820574 | L atm per mole kelvin |
| mmHg and L | 62.3636 | L mmHg per mole kelvin |
| psi and L | 1.20591 | L psi per mole kelvin |
| Energy in calories | 1.98720 | cal per mole kelvin (thermochemical calorie, 4.184 J) |
| Unit | Pascals | kPa | atm |
|---|---|---|---|
| 1 atm | 101,325 | 101.325 | 1 |
| 1 kPa | 1,000 | 1 | 0.00987 |
| 1 bar | 100,000 | 100 | 0.98692 |
| 1 mmHg (torr) | 133.322 | 0.1333 | 0.001316 |
| 1 psi | 6,894.757 | 6.8948 | 0.06805 |
| Conditions | Temperature (K) | Pressure (kPa) | Volume of 1 mol (L) |
|---|---|---|---|
| 0 C and 1 atm | 273.15 | 101.325 | 22.414 |
| 0 C and 1 bar | 273.15 | 100.000 | 22.711 |
| 20 C and 1 atm | 293.15 | 101.325 | 24.055 |
| 25 C and 1 atm | 298.15 | 101.325 | 24.465 |
| 25 C and 1 bar | 298.15 | 100.000 | 24.790 |
| Temperature (C) | Temperature (K) | Volume (L) | Compared with 0 C |
|---|---|---|---|
| -50 | 223.15 | 18.31 | 81.7 % |
| 0 | 273.15 | 22.41 | 100.0 % |
| 20 | 293.15 | 24.06 | 107.3 % |
| 25 | 298.15 | 24.47 | 109.2 % |
| 50 | 323.15 | 26.52 | 118.3 % |
| 100 | 373.15 | 30.62 | 136.6 % |
| 200 | 473.15 | 38.83 | 173.2 % |
| Container volume (L) | Pressure (kPa) | Pressure (atm) | Pressure (psi) |
|---|---|---|---|
| 1.0 | 2,478.96 | 24.465 | 359.54 |
| 2.0 | 1,239.48 | 12.233 | 179.77 |
| 5.0 | 495.79 | 4.893 | 71.91 |
| 10.0 | 247.90 | 2.447 | 35.95 |
| 24.5 | 101.33 | 1.000 | 14.70 |
| 50.0 | 49.58 | 0.489 | 7.19 |
| 100.0 | 24.79 | 0.245 | 3.60 |
| Gas | Molar mass (g per mol) | Density (g per L) | Moles in 1 m3 |
|---|---|---|---|
| Hydrogen, H2 | 2.016 | 0.0824 | 40.87 |
| Helium, He | 4.003 | 0.1636 | 40.87 |
| Methane, CH4 | 16.043 | 0.6557 | 40.87 |
| Ammonia, NH3 | 17.031 | 0.6961 | 40.87 |
| Nitrogen, N2 | 28.014 | 1.1450 | 40.87 |
| Dry air (mean) | 28.960 | 1.1837 | 40.87 |
| Oxygen, O2 | 31.998 | 1.3079 | 40.87 |
| Argon, Ar | 39.950 | 1.6329 | 40.87 |
| Carbon dioxide, CO2 | 44.009 | 1.7988 | 40.87 |
| Chlorine, Cl2 | 70.900 | 2.8980 | 40.87 |
| Law | Formula | What is held constant |
|---|---|---|
| Boyle's law | P1 V1 = P2 V2 | Amount of gas and temperature |
| Charles's law | V1 / T1 = V2 / T2 | Amount of gas and pressure |
| Gay-Lussac's law | P1 / T1 = P2 / T2 | Amount of gas and volume |
| Avogadro's law | V1 / n1 = V2 / n2 | Pressure and temperature |
| Combined gas law | P1 V1 / T1 = P2 V2 / T2 | Amount of gas |
| Ideal gas law | P V = n R T | Nothing, R is a constant |
| Temperature (C) | Pressure (kPa) | Pressure (psi) | Pressure (atm) |
|---|---|---|---|
| 0 | 94.41 | 13.69 | 0.932 |
| 20 | 101.33 | 14.70 | 1.000 |
| 40 | 108.24 | 15.70 | 1.068 |
| 60 | 115.15 | 16.70 | 1.136 |
| 80 | 122.06 | 17.70 | 1.205 |
| 100 | 128.98 | 18.71 | 1.273 |
| 150 | 146.26 | 21.21 | 1.443 |
| Mistake | Effect | Fix |
|---|---|---|
| Temperature in Celsius or Fahrenheit | Wildly wrong answer, or a negative one | Convert to kelvin, the calculator does it for you |
| Gauge pressure used as absolute | Pressure too low by about 1 atm | Add atmospheric pressure to a gauge reading first |
| Mixing a litre value of R with kPa in m3 | Off by a factor of 1,000 | Pick R to match the units, or use the calculator |
| Grams used as moles | Off by the molar mass | Switch the amount to mass and enter the molar mass |
| Using the law at very high pressure | Real gas differs from the ideal result | Use a real gas equation of state |
Frequently Asked Questions About the Ideal Gas Law Calculator
How do you calculate the ideal gas law?
Pick the unknown, write PV = nRT and rearrange it. Volume is V = nRT / P, pressure is P = nRT / V, temperature is T = PV / (nR) and moles is n = PV / (RT). With 1 mole at 273.15 K and 1 atm, V = 22.414 litres. Convert temperature to kelvin first.
How to calculate PV nRT?
Multiply moles, the gas constant and the kelvin temperature to get nRT, then divide by volume to find pressure, or by pressure to find volume. For 2 mol at 298.15 K in 10 L, nRT is 4,957.9 joules, so P = 495.8 kPa.
How to calculate R in PV nRT?
Rearrange to R = PV / (nT). At 1 atm, 273.15 K and 1 mole the volume is 22.414 L, so R = 1 × 22.414 / 273.15 = 0.08206 L atm per mole kelvin. In SI it is exactly the Avogadro constant times the Boltzmann constant, 8.31446261815324 J per mole kelvin.
What are the 5 gas laws formulas?
Boyle's law is P1V1 = P2V2, Charles's law is V1/T1 = V2/T2, Gay-Lussac's law is P1/T1 = P2/T2 and Avogadro's law is V1/n1 = V2/n2. Combined, they give the ideal gas law PV = nRT. The combined gas law, P1V1/T1 = P2V2/T2, is the same idea for a fixed amount of gas.
How do I find volume from pressure, moles and temperature?
Use V = nRT / P with the temperature in kelvin. For 0.5 mol at 300 K and 2 atm, V = 0.5 × 0.082057 × 300 / 2 = 6.154 litres. Choose Volume in the Solve for list, enter the other three values and the units, and the calculator does the conversions.
Is there an ideal gas law calculator for air?
Yes. Set the amount to mass and enter 28.96 g per mol, the mean molar mass of dry air. At 20 C and 1 atm the density comes out near 1.2039 g per L, close to the published 1.2041 kg per cubic metre. Air is mostly nitrogen and oxygen, so it behaves almost ideally at normal pressure.
How do I use the ideal gas law with mass?
Divide the mass by the molar mass to get moles, n = m / M, then use PV = nRT. Equivalently, PV = (m / M) RT. For 16 g of oxygen, M = 31.998 g per mol, so n = 0.5000 mol. Choose Mass as the amount type and enter the molar mass.
How do I find specific volume with the ideal gas law?
Specific volume is volume per unit mass, v = V / m = RT / (P M). It is the reciprocal of density. For air at 20 C and 1 atm, the calculator's density is 1.2039 g per L, so v = 0.8306 L per g, or 0.831 cubic metres per kilogram.
What does PV = mRT mean?
It is the mass form of the ideal gas law, where m is mass and R is a specific gas constant equal to the universal R divided by the molar mass. For dry air, R specific is about 287.1 J per kilogram kelvin. It gives the same answer as PV = nRT because n = m / M.
What happens to pressure when temperature changes?
At constant volume and amount, pressure is proportional to the kelvin temperature, P2 = P1 x T2 / T1. A rigid container at 1 atm and 20 C reaches 129.0 kPa at 100 C. Enter the temperature you want and solve for pressure, or use the heated container table.
What is the combined gas law?
The combined gas law is P1V1/T1 = P2V2/T2. It merges Boyle's, Charles's and Gay-Lussac's laws for a fixed amount of gas and lets you change pressure, volume and temperature together. You can get the same result by solving the ideal gas law for n at the start and using that n at the end.
Why must temperature be in kelvin?
The law links pressure and volume to the absolute temperature, which is zero when the molecules have no thermal motion. Celsius and Fahrenheit zeros are arbitrary, so using them gives nonsense, such as zero volume at 0 C. The calculator converts C and F to kelvin by adding 273.15 or using (F - 32) × 5/9 + 273.15.
What pressure and volume units can I use?
Pressure can be atm, kPa, bar, mmHg or psi, and volume can be litres, cubic metres or millilitres. Each is converted to pascals and cubic metres inside, so you never need a matching value of R. The results panel shows the pressure, volume and temperature in every supported unit.
What is the volume of one mole of gas at STP?
It depends on which standard you use. At 0 C and 1 atm it is 22.414 L. At 0 C and 1 bar, the current IUPAC standard, it is 22.711 L. At 25 C and 1 atm it is 24.465 L. The molar volume table lists these and more.
What is an ideal gas?
An ideal gas is a model where the particles are points that do not attract or repel each other and collide perfectly elastically. Real gases come close at low pressure and high temperature, when the molecules are far apart and moving fast. Air, nitrogen, oxygen and helium at room conditions are well described by it.
When does the ideal gas law stop working?
It loses accuracy at high pressure, near the boiling point and for gases with strong attractions, such as water vapour or ammonia. Then molecule size and forces matter, and a real gas equation such as van der Waals does better. Treat results above tens of atmospheres as rough.
Do I use gauge or absolute pressure?
Always absolute. A gauge reading shows pressure above the atmosphere, so add about 1 atm. A tyre at 32 psi gauge is about 46.7 psi absolute at sea level, 322.0 kPa. Using the gauge value alone gives a volume that is far too large.
How do I solve for temperature in PV = nRT?
Rearrange to T = PV / (nR). With 2 atm, 5 L and 0.4 mol, T = 304.66 K, which is 31.51 C. Pick Temperature in the Solve for list, enter the pressure, volume and moles, and choose kelvin, Celsius or Fahrenheit for the answer. The absolute temperature must come out above zero kelvin.
How do I solve for moles in PV = nRT?
Rearrange to n = PV / (RT). A 5 L container at 1 atm and 20 C holds 0.2079 mol. Multiply by the molar mass for grams: with 28.96 g per mol for air that is 6.02 g. The calculator shows both.
Can I heat a sealed container using these results?
The calculation only estimates pressure. Never heat a sealed or unrated container, since pressure rises fast and vessels can fail violently. Use equipment rated for the pressure and temperature, include a relief device where required, and follow the manufacturer's instructions and local safety rules.
References
- [1] National Institute of Standards and Technology. “CODATA value: molar gas constant.” NIST Reference on Constants, Units, and Uncertainty. Accessed 2026-10-07.
- [2] Wikipedia contributors. “Gas constant.” Wikipedia. Accessed 2026-10-07.
- [3] Wikipedia contributors. “Ideal gas law.” Wikipedia. Accessed 2026-10-07.
- [4] Wikipedia contributors. “Standard temperature and pressure.” Wikipedia. Accessed 2026-10-07.
- [5] Wikipedia contributors. “Density of air.” Wikipedia. Accessed 2026-10-07.
- [6] Wikipedia contributors. “Standard atomic weight.” Wikipedia. Accessed 2026-10-07.
Related calculators
- Amps to Kilowatts CalculatorConvert amps to kilowatts for DC, single-phase and three-phase circuits, with power factor, kVA, kWh per day or month and an optional energy cost.Open
- Binomial Distribution CalculatorBinomial distribution calculator. Enter trials, success probability and successes for exact, at most, at least and between probabilities, plus mean.Open
- Box Plot CalculatorBox plot calculator with steps: get Q1, median, Q3, whiskers, fences and outliers from data or five numbers, with a text box and whisker plot.Open
- Boyle's Law CalculatorBoyle's law calculator: solve P1 V1 = P2 V2 for pressure or volume in atm, kPa, bar, mmHg, psi, L, mL or m3, with gauge pressure and examples.Open
