AJ Designer

Ideal Gas Law Calculator

Pressure equals moles times gas constant times temperature divided by volume

Solution

Share:

Ideal Gas Law (PV = nRT)

The ideal gas law connects pressure, volume, amount of gas, and temperature through a single equation. If you know any three of these quantities you can solve for the fourth. The universal gas constant R equals 0.08206 L·atm/(mol·K) when using atmospheres and liters, or 8.314 J/(mol·K) in SI units.

P = nRT / V

Density Form of the Ideal Gas Law

The density form replaces moles with density and a specific gas constant, making it useful when working with mass instead of moles. All values are in SI units: pascals, kg/m³, J/(kg·K), and kelvin.

ρ = P / (R_specific × T)

Boyle’s Law (P₁V₁ = P₂V₂)

Boyle’s law is a special case of the ideal gas law that applies when temperature and the amount of gas are constant. It states that pressure and volume are inversely proportional: compressing a gas to half its volume doubles its pressure.

P₁V₁ = P₂V₂

How It Works

The ideal gas law PV = nRT connects pressure, volume, amount of gas, and temperature through a single equation. If you know any three of these quantities you can solve for the fourth. The calculator also supports a density form for working with mass instead of moles, and Boyle’s law for constant-temperature processes. The universal gas constant R equals 0.08206 L·atm/(mol·K) when using atmospheres and liters, or 8.314 J/(mol·K) in SI units. Temperature must always be in kelvin (absolute) for gas law calculations.

Example Problem

A 2.0 mol sample of nitrogen gas is held in a 10.0 L container at 300 K. What is the pressure?

  1. Identify the knowns. Amount of gas n = 2.0 mol, temperature T = 300 K (already absolute), volume V = 10.0 L, and the gas constant R = 0.08206 L·atm/(mol·K) for these units.
  2. Identify what we're solving for. We want the pressure P inside the sealed container in atmospheres.
  3. Write the ideal gas law and rearrange for pressure: PV = nRT, so P = nRT / V.
  4. Substitute the known values: P = (2.0 × 0.08206 × 300) / 10.0.
  5. Simplify the numerator: 2.0 × 0.08206 × 300 = 49.236, then divide by 10.0 to get 4.9236.
  6. **P ≈ 4.92 atm** — about 4.9 times atmospheric pressure inside the container.

For Boyle’s law: if a gas at 2 atm occupies 5 L, compressing it to 2 L at constant temperature gives P₂ = (2 × 5) / 2 = 5 atm.

When to Use Each Variable

  • Solve for Pressurewhen you know volume, moles, and temperature, e.g., finding the pressure in a sealed container at a given temperature.
  • Solve for Volumewhen you know pressure, moles, and temperature, e.g., determining the volume a gas occupies at STP.
  • Solve for Moleswhen you know pressure, volume, and temperature, e.g., calculating the amount of gas in a container.
  • Solve for Temperaturewhen you know pressure, volume, and moles, e.g., finding the temperature needed to achieve a target pressure.
  • Solve for Densitywhen you know pressure, specific gas constant, and temperature, e.g., calculating air density at altitude.
  • Solve for P₁ (Boyle's Law)when you know the final state and initial volume at constant temperature, e.g., finding the starting pressure before compression.

Key Concepts

The ideal gas law PV = nRT connects four state variables through the universal gas constant R. Temperature must always be in kelvin (absolute scale) because gas properties are proportional to molecular kinetic energy. The law assumes gas molecules have negligible volume and no intermolecular forces — it works well at moderate pressures and temperatures but breaks down near condensation points or above ~10 atm.

Applications

  • Chemistry: predicting gas behavior in reactions, including volume changes and pressure buildup
  • Aerospace engineering: calculating air density at different altitudes for lift and drag analysis
  • HVAC design: sizing ductwork and determining air volumes at different temperatures and pressures
  • Scuba diving: calculating tank pressure changes with depth and temperature using Boyle's and the ideal gas law
  • Industrial processes: designing pressure vessels and gas storage systems

Common Mistakes

  • Using Celsius or Fahrenheit instead of kelvin — gas law equations require absolute temperature
  • Applying the ideal gas law at very high pressures — above ~10 atm, use van der Waals or another real gas equation
  • Mixing unit systems — R has different values depending on whether you use atm/L or Pa/m³
  • Forgetting that Boyle's law requires constant temperature — if temperature changes, use the full ideal gas law instead

Frequently Asked Questions

What is the ideal gas law formula?

The ideal gas law is PV = nRT, where P is pressure, V is volume, n is the number of moles, R is the gas constant, and T is absolute temperature in kelvin. It assumes gas molecules have negligible volume and no intermolecular forces.

When does the ideal gas law not work?

The ideal gas law becomes inaccurate at very high pressures (above ~10 atm) or very low temperatures near a gas’s condensation point. Under those conditions, intermolecular forces and molecular volume matter, and equations like the van der Waals equation give better results.

Why must temperature be in kelvin for gas laws?

Gas law equations require absolute temperature because pressure and volume are proportional to the thermal energy of the gas molecules. Zero kelvin represents zero molecular kinetic energy. Using Celsius or Fahrenheit would produce incorrect results because those scales have arbitrary zero points.

What is the difference between Boyle’s law and the ideal gas law?

Boyle’s law (P₁V₁ = P₂V₂) is a special case of the ideal gas law that applies when temperature and the amount of gas are constant. The full ideal gas law covers any combination of changing pressure, volume, moles, and temperature.

How do you calculate moles of a gas from pressure and volume?

Rearrange the ideal gas law to n = PV / (RT). For example, a gas at 1 atm in a 22.4 L container at 273.15 K contains about 1 mol — this is the standard molar volume at STP.

What is the specific gas constant and how is it different from R?

The universal gas constant R = 8.314 J/(mol·K) is the same for all gases. The specific gas constant R_specific = R / M (where M is the molar mass in kg/mol) is unique to each gas. Dry air has R_specific ≈ 287 J/(kg·K). The density form ρ = P/(R_specific·T) lets you work in mass units instead of moles.

How are Charles's law and Gay-Lussac's law related to the ideal gas law?

All three are special cases of PV = nRT. Boyle's law (P₁V₁ = P₂V₂) holds at constant T and n. Charles's law (V₁/T₁ = V₂/T₂) holds at constant P and n. Gay-Lussac's law (P₁/T₁ = P₂/T₂) holds at constant V and n. The combined gas law (P₁V₁/T₁ = P₂V₂/T₂) covers all three when only n is constant.

How accurate is the ideal gas law for real gases?

At standard conditions (1 atm, 25 °C) most common gases obey PV = nRT to within 1%. Accuracy degrades above ~10 atm, below ~−100 °C, and near phase transitions. For high-pressure or low-temperature work, use real-gas equations like van der Waals (P + an²/V²)(V − nb) = nRT or the Redlich-Kwong equation, which add molecular volume and attraction corrections.

Reference: Tipler, Paul A. 1995. Physics For Scientists and Engineers. Worth Publishers. 3rd ed. Lindeburg, Michael R. 1992. Engineer In Training Reference Manual. Professional Publication, Inc. 8th ed.

Worked Examples

Chemistry

What pressure does 5 mol of propane reach in a 2-liter cylinder at 25 °C?

A lab cylinder holds 5 mol of propane gas in 2 L of internal volume at room temperature (25 °C = 298.15 K). Use PV = nRT to estimate the cylinder pressure (treating propane as ideal — real propane liquefies above ~10 atm at room temperature, so this is the ideal-gas upper bound).

  • Knowns: n = 5 mol, V = 2 L, T = 298.15 K
  • R = 0.08206 L·atm/(mol·K)
  • P = (n × R × T) / V
  • P = (5 × 0.08206 × 298.15) / 2
  • P = 122.33 / 2

P ≈ 61.17 atm

Real propane condenses to a liquid above about 10 atm at 25 °C, so a real cylinder at this density would be partly liquid. The ideal-gas number is still useful for the upper bound and for understanding why propane is stored under pressure.

Aerospace

What is the air density at a 10 km cruise altitude?

Commercial jets cruise near 10 km altitude where standard-atmosphere conditions are P = 26,500 Pa and T = 223 K. Use the density form of the ideal gas law (ρ = P / (R × T) with R_specific for air = 287 J/(kg·K)) to estimate cruise-altitude air density.

  • Knowns: P = 26,500 Pa, T = 223 K, R = 287 J/(kg·K)
  • ρ = P / (R × T)
  • ρ = 26,500 / (287 × 223)
  • ρ = 26,500 / 64,001

ρ ≈ 0.414 kg/m³

The U.S. Standard Atmosphere lists 0.4135 kg/m³ at 10 km — essentially the same number. This is why high-altitude flight needs cabin pressurization and why turbine engines work harder to swallow enough mass per second at cruise.

Scuba Diving

How much does a diver's lung volume compress at 30 m depth?

A scuba diver takes a 6 L breath at the surface (1 atm) and then breath-holds while descending to 30 m, where the absolute pressure is 4 atm. Use Boyle's Law (P₁V₁ = P₂V₂) to estimate the compressed lung volume.

  • Knowns: P₁ = 1 atm, V₁ = 6 L, P₂ = 4 atm
  • P₁ × V₁ = P₂ × V₂
  • V₂ = (P₁ × V₁) / P₂
  • V₂ = (1 × 6) / 4

V₂ = 1.5 L

Lungs compress to 25% of their surface volume at 30 m, which is why free-divers practice equalization and breath-control techniques. Compressed-air scuba avoids the issue because the regulator delivers air at ambient pressure on every breath.

Ideal Gas Law Formulas

The ideal gas law and its specializations describe the behavior of gases under varying pressure, volume, temperature, and amount:

PV = nRTUniversal ideal gas law (mole form)
P = ρ × Rspecific × TDensity form (mass-based)
P₁ × V₁ = P₂ × V₂Boyle's law (constant T and n)

Where:

  • P — absolute pressure (Pa, atm, or other pressure units)
  • V — volume of the container (L or m³)
  • n — amount of gas in moles (mol)
  • R — universal gas constant = 0.08206 L·atm/(mol·K) = 8.314 J/(mol·K)
  • T — absolute temperature (kelvin); always K, never °C or °F
  • ρ — gas density (kg/m³)
  • Rspecific — gas-specific constant = R / molar mass (J/(kg·K))
  • P₁, V₁ — initial state for Boyle's law transition
  • P₂, V₂ — final state for Boyle's law transition

The ideal gas law assumes molecules have negligible volume and no intermolecular forces — accurate within ~1% for common gases at moderate temperatures and pressures (~1 atm, ~25 °C). At very high pressures (above ~10 atm), very low temperatures, or near phase transitions, use real-gas equations like van der Waals instead. Temperature must always be in kelvin because gas pressure and volume scale with absolute molecular kinetic energy.

Related Calculators

Related Sites