On this page
Formula
P × V = n × R × T
- P
- absolute pressure of the gas
- V
- volume the gas occupies
- n
- amount of gas in moles
- R
- molar gas constant, 8.314462618 J/(mol·K) = 0.0820574 L·atm/(mol·K)
- T
- absolute temperature in kelvin (K = °C + 273.15)
What the ideal gas law says
The ideal gas law ties together the four quantities that describe a gas: pressure, volume, amount and temperature.
PV = nRT
It combines the older gas laws into one equation. Boyle’s law (pressure and volume are inversely related), Charles’s law (volume grows with temperature) and Avogadro’s law (volume grows with the number of molecules) are all special cases. R, the molar gas constant, is the link between them. Since the 2019 redefinition of the SI it has an exact value: 8.314462618… J/(mol·K).
The model assumes gas molecules take up no space and don’t attract each other. Real gases come close to that at ordinary pressures and temperatures, which is why the equation works so well for air, nitrogen, oxygen, helium and carbon dioxide near room conditions.
How to use the ideal gas law calculator
- Choose what to solve for: pressure, volume, amount of gas (moles) or temperature.
- Enter the other three values. Pressure can be in atm, kPa, Pa, mmHg, bar or psi; volume in liters, milliliters or cubic meters; temperature in °C, °F or kelvin.
- Pick the unit you want the answer in using the selector next to the blank field.
- Optionally enter the gas’s molar mass (for example 28.97 g/mol for air or 4.003 g/mol for helium) to see the mass and density of the gas too.
The ideal gas law calculator converts everything to SI units, solves the equation, and shows each step with your numbers, plus a table of R in common units.
How to calculate with the ideal gas law by hand
Two moles of gas fill a 25 L container at 300 K. What is the pressure in atmospheres?
- Pick R to match your units: liters and atmospheres means R = 0.082057 L·atm/(mol·K).
- Rearrange for pressure: P = nRT ÷ V.
- Substitute: P = 2 × 0.082057 × 300 ÷ 25 = 1.97 atm.
Converting units first
The most reliable method is to convert everything to SI before you start: pressure in pascals, volume in cubic meters, temperature in kelvin. Then R = 8.314 J/(mol·K) and the answer comes out in SI units too. Add 273.15 to a Celsius temperature to get kelvin, and divide liters by 1,000 to get cubic meters.
Gas density
Combining PV = nRT with n = mass ÷ molar mass gives the density form:
density = PM ÷ RT
For dry air (M = 28.97 g/mol) at 20 °C and 1 atm: 1 × 28.97 ÷ (0.082057 × 293.15) = 1.204 g/L. Warmer air is less dense, which is why hot-air balloons rise.
Molar volume of an ideal gas
The volume of 1 mol of ideal gas at common reference conditions. Densities are for dry air at 28.97 g/mol.
| Conditions | Temperature | Pressure | Molar volume | Air density |
|---|---|---|---|---|
| STP (older definition) | 0 °C | 1 atm | 22.414 L | 1.2925 g/L |
| STP (IUPAC, since 1982) | 0 °C | 1 bar | 22.711 L | 1.2756 g/L |
| Room temperature | 20 °C (68 °F) | 1 atm | 24.055 L | 1.2043 g/L |
| SATP | 25 °C | 1 bar | 24.790 L | 1.1686 g/L |
| 25 °C, sea level | 25 °C | 1 atm | 24.465 L | 1.1841 g/L |
| Body temperature | 37 °C | 1 atm | 25.450 L | 1.1383 g/L |
Real-life uses
- Chemistry labs: finding the moles of gas produced in a reaction from the volume collected.
- Compressed gas cylinders: estimating how much gas a tank holds, or how its pressure rises in a hot car.
- HVAC and weather: air density at a given temperature and pressure for airflow and altitude calculations.
- Diving and ballooning: how a fixed amount of gas expands or compresses with depth or altitude.
- Engineering: first estimates for compressors and pipelines before applying real-gas corrections.
For converting a temperature between Celsius, Fahrenheit and kelvin on its own, use the temperature converter. The density calculator handles solids and liquids, where the ideal gas law doesn’t apply, and the molarity calculator covers concentrations in solution.
Common mistakes
- Using Celsius or Fahrenheit directly. Temperature must be absolute. 25 °C is 298.15 K.
- Using gauge pressure. A tire gauge reading 35 psi means about 49.7 psi absolute. At 20 °C, 1 L of air at 35 psi gauge holds about 0.141 mol, while plugging in 35 psi directly gives 0.0990 mol, about 30% too little.
- Mismatched R. Using 0.08206 with kPa or 8.314 with atm gives answers off by a factor of about 101. Either convert your units or choose the matching R.
- Forgetting milliliters. 250 mL is 0.25 L. With R in L·atm/(mol·K), volume must be in liters.
- Applying it to liquids or near condensation. Steam close to 100 °C, or gases at hundreds of atmospheres, need real-gas equations such as van der Waals.
Glossary
- Absolute pressure: pressure measured from a perfect vacuum; gauge pressure plus atmospheric pressure.
- Kelvin (K): the absolute temperature scale; 0 K is absolute zero.
- Mole (mol): 6.02214076 × 10²³ particles.
- STP: standard temperature and pressure, 0 °C with either 1 atm (older) or 1 bar (IUPAC).
- Ideal gas: a model gas whose molecules have no volume and no attractions, obeying PV = nRT exactly.
Worked examples
Pressure of a gas cylinder
4 mol of nitrogen in a 10 L cylinder at 20 °C. What is the pressure in atmospheres?
Inputs: Solve for = Pressure; Pressure (P) unit = Atmospheres; Volume (V) = 10; Volume (V) unit = Liters; Amount of gas (n) = 4 mol; Temperature (T) = 20; Temperature (T) unit = Celsius
Convert to SI: 0.01 m³, 4 mol, 293.15 K P = nRT ÷ V = 4 mol × 8.314462618 J/(mol·K) × 293.15 K ÷ 0.01 m³ = 974,954 Pa 974,954 Pa = 9.62205 atm
Answer: Volume 10 L, Amount of gas 4 mol, Temperature 20 °C give pressure 9.62205 atm (PV = nRT).
Moles of air in a room
A 30 m³ room at sea-level pressure (101.325 kPa) and 72 °F.
Inputs: Solve for = Amount of gas; Pressure (P) = 101.325; Pressure (P) unit = Kilopascals; Volume (V) = 30; Volume (V) unit = Cubic meters; Temperature (T) = 72; Temperature (T) unit = Fahrenheit
Convert to SI: 101,325 Pa, 30 m³, 295.372 K n = PV ÷ RT = 101,325 Pa × 30 m³ ÷ (8.314462618 J/(mol·K) × 295.372 K) = 1,237.75 mol 1,237.75 mol = 1,237.75 mol
Answer: Pressure 101.325 kPa, Volume 30 m³, Temperature 72 °F give amount of gas 1,237.75 mol (PV = nRT).
Volume of a balloon in mL
0.05 mol of helium at 760 mmHg and 298.15 K.
Inputs: Solve for = Volume; Pressure (P) = 760; Pressure (P) unit = Millimeters of mercury; Volume (V) unit = Milliliters; Amount of gas (n) = 0.05 mol; Temperature (T) = 298.15; Temperature (T) unit = Kelvin
Convert to SI: 101,325 Pa, 0.05 mol, 298.15 K V = nRT ÷ P = 0.05 mol × 8.314462618 J/(mol·K) × 298.15 K ÷ 101,325 Pa = 0.00122327 m³ 0.00122327 m³ = 1,223.27 mL
Answer: Pressure 760 mmHg, Amount of gas 0.05 mol, Temperature 298.15 K give volume 1,223.27 mL (PV = nRT).
Edge case: temperature from P, V and n
0.4 mol of gas in 5 L at 2 bar. What temperature is it, in °C?
Inputs: Solve for = Temperature; Pressure (P) = 2; Pressure (P) unit = Bar; Volume (V) = 5; Volume (V) unit = Liters; Amount of gas (n) = 0.4 mol; Temperature (T) unit = Celsius
Convert to SI: 200,000 Pa, 0.005 m³, 0.4 mol T = PV ÷ nR = 200,000 Pa × 0.005 m³ ÷ (0.4 mol × 8.314462618 J/(mol·K)) = 300.681 K 300.681 K = 27.5309 °C
Answer: Pressure 2 bar, Volume 5 L, Amount of gas 0.4 mol give temperature 27.5309 °C (PV = nRT).
Assumptions and limitations
- The gas is treated as ideal. Real gases follow PV = nRT closely at low pressures and temperatures well above their boiling points, such as air or helium near room conditions. At high pressure or near condensation, results can be off by several percent or more.
- Pressure must be absolute. A tire or cylinder gauge reads pressure above the atmosphere, so add about 14.7 psi (101.325 kPa) to a gauge reading first.
- Temperatures are converted to kelvin before calculating, and must be above absolute zero (0 K, −273.15 °C, −459.67 °F).
- R = 8.314462618 J/(mol·K), the exact CODATA value since the 2019 SI redefinition. The calculation runs in SI units (Pa, m³, mol, K) and converts to the units you choose; 1 atm = 101,325 Pa exactly.
- The optional molar mass gives the mass of gas (n × M) and its density (PM ÷ RT). Dry air averages about 28.97 g/mol.
- Results are shown to 6 significant figures.
Frequently asked questions
What is the ideal gas law formula?
PV = nRT, where P is absolute pressure, V is volume, n is moles of gas, R is the gas constant and T is the temperature in kelvin. Rearranged, P = nRT ÷ V, V = nRT ÷ P, n = PV ÷ RT and T = PV ÷ nR.
What value of R should I use?
Match R to your units. With liters and atmospheres use 0.08206 L·atm/(mol·K); with liters and kilopascals, or SI units, use 8.314 J/(mol·K); with mmHg use 62.36 L·mmHg/(mol·K). The calculator picks the right value for you.
How do you find moles with the ideal gas law?
Use n = PV ÷ RT. A 5 L flask of gas at 1.5 atm and 27 °C (300.15 K) holds 1.5 × 5 ÷ (0.08206 × 300.15) ≈ 0.305 mol.
Why must temperature be in kelvin?
The ideal gas law needs an absolute scale, where zero means no thermal motion. In Celsius, 0 °C would make the volume zero and negative temperatures would give negative volumes, which is impossible.
What is the molar volume of a gas at STP?
About 22.414 L/mol at 0 °C and 1 atm. With the newer IUPAC standard pressure of 1 bar it is 22.711 L/mol, and at 25 °C and 1 atm it is 24.465 L/mol.
How do you calculate gas density with the ideal gas law?
Use density = PM ÷ RT, where M is the molar mass. For dry air (28.97 g/mol) at 20 °C and 1 atm that gives about 1.204 g/L. Enter the molar mass in the calculator to get density alongside the main answer.
What is the difference between the ideal gas law and the combined gas law?
The combined gas law, P₁V₁ ÷ T₁ = P₂V₂ ÷ T₂, compares two states of the same fixed amount of gas. The ideal gas law relates P, V and T to the actual number of moles, so it works for a single state as well.
Sources
- Chemistry 2e, 9.2 Relating Pressure, Volume, Amount, and Temperature: The Ideal Gas Law — OpenStax (Rice University). Checked October 10, 2026.
- Chemistry 2e, 9.3 Stoichiometry of Gaseous Substances, Mixtures, and Reactions — OpenStax (Rice University). Checked October 10, 2026.
- CODATA Value: molar gas constant — NIST Physical Measurement Laboratory. Checked October 10, 2026.