Skip to content
ChemSolver

Ideal Gas Law Calculator

Solve PV = nRT for pressure, volume, moles, or temperature. Enter gas mass and formula, calculate gas density or molar mass, and see unit conversions and step-by-step chemistry calculations.

Loading gas calculator…

What Is the Ideal Gas Law?

The ideal gas law relates pressure, volume, amount of gas, and absolute temperature. It approximates gas behavior when the effects of intermolecular attraction and molecular size are small.

PV equals nRT: absolute pressure times volume equals moles times the gas constant and kelvin temperature
PV = nRT. Convert temperature to kelvin and use an absolute pressure before solving.

PV = nRT

P = absolute pressure; V = gas volume; n = moles; R = molar gas constant; T = temperature in kelvin. The SI value is R = 8.31446261815324 Pa·m³/(mol·K).

Solve PV=nRT for Pressure, Volume, Moles and Temperature

Select the missing quantity, then provide the other three known values. The calculator converts units before applying the rearranged formula.

Pressure (P)

P = nRT / V

Find absolute gas pressure from moles, volume, and temperature.

Volume (V)

V = nRT / P

Find the space occupied by a known amount of gas.

Moles (n)

n = PV / (RT)

Find the amount of gas from pressure, volume, and temperature.

Temperature (T)

T = PV / (nR)

Find absolute temperature, then convert to Celsius or Fahrenheit as needed.

How to Use the Ideal Gas Law Calculator

  1. Choose which quantity to calculate. The three remaining quantities become required inputs.
  2. Choose pressure, volume, and temperature units individually, and enter the known values. For a gas mass problem, switch the amount field to Gas Mass + Formula.
  3. Use a named STP/SATP preset if the problem specifies those conditions. Each preset switches to solving for Volume (V) and fills in the standard pressure and temperature.
  4. Click Calculate, review the rearranged formula and unit conversions, and choose your display precision. Round final lab answers to match your measurement precision.

Ideal Gas Constant R: Values and Units

The numerical value of the universal gas constant changes with the units used. The underlying constant does not change. This calculator uses the SI form internally to avoid mixing incompatible units.

R unitsApproximate value
Pa·m³/(mol·K)8.314462618
kPa·L/(mol·K)8.314462618
L·atm/(mol·K)0.08205737
L·bar/(mol·K)0.08314463
L·Torr/(mol·K)62.3636
cal/(mol·K)1.9872 (approx.)

For L and atm, the familiar classroom approximation is R ≈ 0.082057 L·atm/(mol·K). With pressure in kPa and volume in L, use 8.314462618 kPa·L/(mol·K). The solver uses 8.31446261815324 Pa·m³/(mol·K) for all calculations; the values above are for checking hand-worked problems.

STP vs IUPAC STP vs SATP: Molar Volume of a Gas

The standard temperature is not enough to determine molar volume: you must also know which standard pressure is used. Different chemistry resources use different STP definitions.

ConditionsTemperatureAbsolute pressureIdeal molar volume
Traditional textbook STP0 °C (273.15 K)1 atm (101.325 kPa)22.414 L/mol
IUPAC STP0 °C (273.15 K)100 kPa (1 bar)22.711 L/mol
SATP25 °C (298.15 K)100 kPa (1 bar)24.790 L/mol
Room conditions at 1 atm25 °C (298.15 K)1 atm (101.325 kPa)24.465 L/mol

A textbook answer of 22.4 L per mole refers to the traditional 0 °C, 1 atm conditions; approximately 22.7 L per mole applies at 0 °C and 100 kPa. Use the conditions provided in your assignment.

How to Calculate Gas Volume from Grams and Chemical Formula

Gas problems often give a measured mass rather than moles. Use the gas formula or known molar mass to convert mass to amount, then solve PV = nRT.

44.0 g CO₂ at 25 °C and 1.20 atm

  1. M(CO₂) ≈ 44.01 g/mol using standard atomic weights.
  2. n = 44.0 g ÷ 44.01 g/mol ≈ 0.9998 mol.
  3. T = 25 + 273.15 = 298.15 K.
  4. V = nRT/P ≈ 20.38 L, rounded to 20.4 L to three significant figures.

Enter a gas formula to calculate its molar mass automatically, or enter a known molar mass directly. If you fill in both fields, they must agree.

View the CO₂ molar mass breakdown →

Gas Density and Molar Mass Using PV=nRT

The same ideal-gas equation can find gas density from known molar mass or determine the approximate molar mass of an unknown gas from its collected mass and volume. Switch to the Density & Molar Mass tab above to solve either equation directly.

Ideal gas density

ρ = PM / (RT)

For O₂ at 0 °C and 1 atm, M ≈ 31.998 g/mol. The predicted density is approximately 1.428 g/L.

Molar mass of an unknown gas

M = mRT / (PV)

For a 2.15 g sample at 298 K, 0.950 atm, and 1.25 L, the calculated molar mass is approximately 44.3 g/mol. The calculation does not uniquely identify the gas compound.

The pressure must describe the target gas. In wet-gas collection, a sample may include water vapor: use the target gas partial pressure after an appropriate vapor-pressure correction rather than using total pressure without checking.

Worked Ideal Gas Law Examples

Use these seven solved examples to practice common chemistry assignments, including gas mass and an unknown gas experiment. The calculator shows unrounded numerical output separately from selected display precision.

Gas volume at traditional STP

n = 1.00 mol, T = 273.15 K, P = 1 atm

  1. V = nRT/P
  2. V = (1.00 mol)(0.08205737 L·atm/(mol·K))(273.15 K) / 1 atm
  3. V ≈ 22.414 L, or 22.4 L to three significant figures.

Find pressure from volume and moles

n = 0.500 mol, V = 10.0 L, T = 298.15 K

  1. P = nRT/V
  2. P = (0.500)(0.08205737)(298.15) / 10.0
  3. P ≈ 1.22 atm to three significant figures.

Find moles of gas

P = 2.00 atm, V = 5.00 L, T = 300. K

  1. n = PV/(RT)
  2. n = (2.00)(5.00) / ((0.08205737)(300.))
  3. n ≈ 0.406 mol.

Find temperature from gas data

P = 740 mmHg, V = 5.00 L, n = 0.200 mol

  1. T = PV/(nR)
  2. Convert P: 740 mmHg ≈ 0.973684 atm (treat 740 as having stated measurement precision).
  3. T ≈ 296.65 K, or 23.50 °C before applying input-specific rounding.

Find gas volume from mass and formula

44.0 g CO₂ at 25 °C and 1.20 atm

  1. M(CO₂) ≈ 44.01 g/mol; n = 44.0 / 44.01 ≈ 0.9998 mol.
  2. V = nRT/P, T = 298.15 K.
  3. V ≈ 20.38 L; report 20.4 L to three significant figures.

Molar mass of an unknown gas

m = 2.15 g, P = 0.950 atm, V = 1.25 L, T = 298 K

  1. M = mRT/(PV)
  2. M = (2.15)(0.08205737)(298) / ((0.950)(1.25))
  3. M ≈ 44.3 g/mol.

Oxygen gas density at STP

O₂, T = 0 °C, P = 1 atm, M(O₂) ≈ 31.998 g/mol

  1. ρ = PM/(RT)
  2. ρ ≈ (1)(31.998) / ((0.08205737)(273.15))
  3. ρ ≈ 1.428 g/L.

Ideal Gas Law vs Combined Gas Law

PV = nRT calculates an individual gas state. The combined gas law compares two states of a fixed amount of ideal gas: P₁V₁/T₁ = P₂V₂/T₂.

Use PV = nRT when you know three of the four gas state variables, including amount n. Use the combined gas law when a closed amount of gas changes from one pressure, volume, and temperature state to another and the number of moles remains constant. Boyle’s law, Charles’s law, and Avogadro’s law are limiting relationships derived from the ideal gas model.

When Does the Ideal Gas Law Fail?

Real gas molecules occupy volume and attract or repel one another. Deviations generally increase at high pressure, lower temperature, and near condensation; their size depends on the gas and experimental conditions. Do not apply a universal pressure threshold for all gases. For high-accuracy work, consider measured gas compressibility or an appropriate non-ideal equation of state.

Common Ideal Gas Law Mistakes and Practice Problems

Most wrong answers come from temperature, pressure, and gas-amount interpretation, not from rearranging PV = nRT.

Using Celsius directly

Convert absolute temperature to K before calculating.

Using gauge pressure

The ideal gas law uses absolute pressure; check whether the instrument reports gauge pressure.

Mixing atm and kPa

Use an R value matching the units or consistently convert to SI.

Using grams in place of moles

Divide measured gas mass by its molar mass before inserting n.

Treating all STP values as identical

0 °C at 1 atm and 0 °C at 100 kPa give different molar volumes.

Ignoring water vapor

When a gas is collected over water, total pressure may include water vapor pressure.

Practice with answers

What volume does 1.00 mol of ideal gas occupy at IUPAC STP?

Approximately 22.711 L before measurement-specific rounding; 22.7 L to three significant figures.

What pressure does 0.500 mol of ideal gas exert in 10.0 L at 298.15 K?

P = nRT/V ≈ 1.22 atm.

How many moles occupy 5.00 L at 2.00 atm and 300. K?

n = PV/(RT) ≈ 0.406 mol.

How much ideal gas is 44.0 g CO₂ in moles?

44.0 ÷ 44.01 ≈ 0.9998 mol, or 1.00 mol to three significant figures.

How does 25 °C differ from 25 K in the gas law?

25 °C is 298.15 K; 25 K is approximately −248.15 °C. They must never be interchanged.

Does 1 mol of gas always occupy 22.4 L?

No. That value is an approximation for an ideal gas at 0 °C and 1 atm, not a universal gas molar volume.

Ideal Gas Law Unit Conversion: A Complete Worked Method

The fastest reliable way to solve PV = nRT is to convert every known value into compatible units before substituting. The calculator uses pascals, cubic meters, moles, and kelvin internally.

Example: convert 750 mmHg, 250 mL, and 27 °C

  1. Pressure: 750 mmHg × 133.322 Pa/mmHg ≈ 99,992 Pa.
  2. Volume: 250 mL × 10⁻⁶ m³/mL = 0.000250 m³.
  3. Temperature: 27 °C + 273.15 = 300.15 K.
  4. Now use n = PV/(RT) with R = 8.314462618 Pa·m³/(mol·K) to calculate approximately 0.0100 mol.

Why the unit cancellation works

The numerator PV has units Pa·m³, equivalent to joules. In the denominator, R × T has units Pa·m³/mol. Their ratio therefore has units of mol.

n = (Pa·m³) / (Pa·m³/mol) = mol

If you calculate with atm and liters instead, use R ≈ 0.082057 L·atm/(mol·K). Never substitute degrees Celsius directly into either version.

Ideal Gas Collected Over Water: Using Dry Gas Pressure

In a common chemistry lab, gas is collected by displacing water. The pressure inside the collecting container can include both the desired gas and water vapor. Using the entire measured pressure in PV = nRT can overestimate the amount of dry gas.

Worked example: gas collected over water at 25 °C

Suppose the total pressure is 755.0 mmHg, the water vapor pressure at 25 °C is approximately 23.8 mmHg, and the collected gas occupies 0.500 L at 25 °C. Assume the gas and water vapor share the same temperature, the measurement is at pressure equilibrium, and no additional vapor is present.

  1. Apply Dalton’s law: P(dry gas) = P(total) − P(water vapor).
  2. P(dry gas) = 755.0 − 23.8 = 731.2 mmHg.
  3. Convert dry pressure: 731.2 ÷ 760 ≈ 0.9621 atm; temperature = 298.15 K.
  4. Calculate n = PV/(RT) = (0.9621 × 0.500)/(0.082057 × 298.15) ≈ 0.0197 mol (three significant figures).

Enter 731.2 mmHg as the absolute pressure in the calculator; it does not automatically subtract water vapor pressure. The 23.8 mmHg value is illustrative and depends on temperature. If water levels differ, a hydrostatic pressure correction may also be needed.

Absolute Pressure vs Gauge Pressure in Gas Law Problems

The pressure in PV = nRT is always absolute pressure. Gauge pressure is measured relative to surrounding atmospheric pressure, so it cannot be used directly without conversion.

P(absolute) = P(gauge) + P(atmospheric)

Example: a pressure gauge reports 50 kPa above a surrounding atmospheric pressure of 101.325 kPa. The absolute pressure is 151.325 kPa. Enter 151.325 kPa, not 50 kPa, into the ideal gas calculator.

A vacuum gauge can even read negative relative to atmospheric pressure, as long as the resulting absolute pressure stays positive.

Deriving Gas Density and Molar Mass from PV=nRT

These two frequently tested equations follow from the original ideal gas law, not from a separate gas model. The conversion from a measured sample mass to moles is the connection.

Gas density derivation

Use n = m/M and density ρ = m/V. Substitute n into PV = nRT:

PV = (m/M)RT

ρ = m/V = PM/(RT)

Higher absolute pressure raises ideal-gas density at fixed temperature and composition; higher absolute temperature lowers it.

Unknown gas molar mass derivation

Rearrange for M when the sample’s mass m, gas volume V, pressure P, and temperature T are known:

M = mRT/(PV)

An approximate molar mass alone does not uniquely identify an unknown gas; several substances can have similar molecular masses. Measurement uncertainty and real-gas behavior can also affect the estimate.

Ideal Gas Law in Chemistry: Reaction Stoichiometry and Gas Volume

When a balanced chemical equation determines the number of moles of gaseous product, PV = nRT converts that amount into a predicted gas volume at the specified temperature and pressure.

Example: hydrogen gas produced from magnesium

Mg + 2HCl → MgCl₂ + H₂

Suppose 0.100 mol Mg reacts completely with excess hydrochloric acid, and all the resulting H₂ can be treated as an ideal gas. Calculate its volume at 25 °C and 1.00 atm.

  1. The balanced equation gives a 1:1 mole ratio between Mg and H₂.
  2. Theoretical n(H₂) = 0.100 mol; T = 298.15 K.
  3. V = (0.100 × 0.082057 × 298.15)/1.00 ≈ 2.45 L H₂.

This assumes complete reaction and dry hydrogen at the stated absolute pressure. If the gas is captured over water, correct for water vapor pressure before computing dry-gas moles or volume.

Calculate the reaction mole ratio →

Ideal Gas Law Results and Significant Figures

The calculator’s 2–6 significant-figure selector controls display formatting. It does not determine the experimental uncertainty or automatically infer the least precise measurement from how a number was entered.

In a textbook question, round the final answer according to the stated measurement precision. Keep intermediate gas-law calculations unrounded. Temperature conversions to kelvin and exact unit conversion factors should not be treated as new low-precision measurements.

For example, at traditional STP, one mole of ideal gas occupies about 22.41397 L in the calculation. If your mole amount is specified as 1.00 mol, a three-significant-figure reported answer is 22.4 L; selecting six significant figures merely displays more digits, not a more accurate experiment.

Review significant-figure rules →

Frequently Asked Questions

Quick answers to common ideal gas equation, R constant, STP, and gas density questions.

What is the ideal gas law formula?

The ideal gas law is PV = nRT, where P is absolute pressure, V is volume, n is the amount in moles, R is the molar gas constant, and T is absolute temperature in kelvin.

How do I calculate pressure using PV=nRT?

Use P = nRT/V. For n = 0.500 mol, T = 298.15 K, and V = 10.0 L, the ideal pressure is approximately 1.22 atm.

Which R value should I use for liters and atmospheres?

R is approximately 0.082057 L·atm/(mol·K) with P in atm and V in L. This calculator uses 8.31446261815324 Pa·m³/(mol·K) internally and converts inputs and outputs, which is equivalent.

Why must temperature be in Kelvin?

The gas law relates absolute temperature to gas volume and pressure. Convert °C using K = °C + 273.15 or °F using K = (°F − 32) × 5/9 + 273.15. You cannot substitute Celsius directly.

What is the volume of one mole of gas at STP?

At 0 °C and 1 atm, one mole of ideal gas occupies approximately 22.414 L. At the IUPAC standard pressure of 100 kPa and 0 °C, it occupies approximately 22.711 L. The standards differ.

Can I calculate gas volume when I am given grams?

Yes. Divide the gas mass by its molar mass to get moles, n = m/M, and then calculate V = nRT/P. Enter a valid gas formula such as CO2 or a known molar mass.

How do I find gas density and molar mass?

Ideal-gas density is ρ = PM/(RT), with consistent units. For an unknown gas sample, M = mRT/(PV) uses sample mass, absolute pressure, gas volume, and temperature.

What if my gas was collected over water?

Gas collected over water mixes with water vapor, so the measured total pressure is higher than the dry gas pressure. Subtract the water vapor pressure at the measurement temperature before solving PV = nRT, because this calculator does not apply that correction automatically.

What is the difference between the ideal and combined gas laws?

PV = nRT relates a gas sample’s pressure, volume, mole amount, and temperature. The combined gas law compares two states of the same fixed amount of gas: P₁V₁/T₁ = P₂V₂/T₂, using absolute temperatures.

When is the ideal gas law inaccurate?

Real gases depart from ideal behavior when intermolecular interactions and molecular volume matter, often at high pressures, low temperatures, or near condensation. The size of the deviation depends on the gas and conditions.

How do I use gauge pressure with the ideal gas law?

Convert gauge pressure to absolute pressure by adding the local atmospheric pressure. For example, 50 kPa gauge at 101.325 kPa atmospheric pressure is 151.325 kPa absolute.

How do I calculate dry gas pressure with Dalton’s law?

Apply Dalton’s law of partial pressures: P(dry gas) = P(total) − P(water vapor), plus any water-level hydrostatic pressure adjustment required by the apparatus. Then enter P(dry gas) as the absolute pressure in PV = nRT.

How does stoichiometry connect to gas volume?

Use a balanced reaction and the limiting reactant to calculate moles of gaseous product, then use V = nRT/P at the given absolute pressure and kelvin temperature. A gas collected over water may require an additional pressure correction.

Does choosing more significant figures make a gas law result more accurate?

No. The 2–6 significant-figure option changes display precision, not measurement uncertainty. Round the final result according to the precision supported by the inputs and your laboratory or classroom instructions.