ciencia

Ideal Gas Law Calculator (PV = nRT)

Calculator Free · Private
Was this calculator helpful?

The Ideal Gas Law Calculator solves for the number of moles (n) of a gas using the equation PV = nRT, where P is absolute pressure in Pascals (Pa), V is volume in cubic meters (m³), T is absolute temperature in Kelvin (K), and R is the universal gas constant (8.314 J·mol⁻¹·K⁻¹). This law combines Boyle's Law (P∝1/V), Charles's Law (V∝T), and Avogadro's Law (V∝n) into one unified equation. It is valid for ideal gas behavior — low pressures and high temperatures where intermolecular forces are negligible. Enter any three known variables to instantly solve for the fourth.

Last reviewed: April 18, 2026 Verified by Hacé Cuentas Team Source: NIST — Fundamental Physical Constants (CODATA 2018): Gas Constant R, NIST — Ideal Gas Law and Thermodynamic Properties (WebBook), Wikipedia EN — Ideal Gas Law 100% private

When to use this calculator

  • Chemistry lab: calculating how many moles of nitrogen gas are contained in a 10 L tank pressurized to 5 atm (506,625 Pa) at room temperature (298 K).
  • Engineering: verifying the amount of CO₂ produced in a combustion reaction by measuring post-reaction gas pressure and volume in a sealed vessel.
  • Education: confirming that exactly 1 mole of any ideal gas occupies 22.414 L at STP (0°C, 1 atm) — the classic molar volume demonstration.
  • Scuba diving safety: estimating how the volume of a gas bubble changes as a diver ascends from 30 m depth (4 atm) to the surface (1 atm) at constant temperature.
  • Industrial process control: determining the number of moles of hydrogen gas produced during electrolysis by measuring tank pressure increase over time at a known temperature.

Calculation Example

  1. 1 atm, 22.4 L, 273K
  2. n = 101325×0.0224/(8.314×273) = 1 mol
Result: ~1 mol (standard conditions)

How it works

3 min read

How It Is Calculated

The Ideal Gas Law relates four state variables of an ideal gas:

PV = nRT

Solving for moles:
n = (P × V) / (R × T)

Where:
  P = Absolute pressure          [Pascals, Pa]
  V = Volume                     [cubic meters, m³]
  n = Amount of substance        [moles, mol]
  R = Universal gas constant     8.314 J·mol⁻¹·K⁻¹  (NIST CODATA 2018)
  T = Absolute temperature       [Kelvin, K]

Unit conversions you must apply BEFORE calculating:
  1 atm  = 101,325 Pa
  1 L    = 0.001 m³
  °C → K = °C + 273.15
  1 bar  = 100,000 Pa
  1 psi  = 6,894.76 Pa

The value of R = 8.314462618 J·mol⁻¹·K⁻¹ is an exact defined constant since the 2019 SI redefinition of the mole (NIST).

---

Reference Table

Common conditions and corresponding molar volumes for an ideal gas:

ConditionT (K)P (Pa)Molar Volume (L/mol)
STP (IUPAC 1982)273.15101,32522.414
STP (IUPAC 2014)273.15100,00022.711
NTP (20°C, 1 atm)293.15101,32524.055
Room Temp (25°C, 1 atm)298.15101,32524.466
Body Temp (37°C, 1 atm)310.15101,32525.447
Liquid N₂ boiling (77 K, 1 atm)77.00101,3256.319

> Note: IUPAC changed the standard pressure definition from 101,325 Pa (1 atm) to exactly 100,000 Pa (1 bar) in 1982. Many textbooks still use the older definition. Always verify which STP your course or industry uses.

---

Typical Cases

Case 1 — Classic STP Verification


  • Given: P = 101,325 Pa, V = 0.02241 m³ (22.41 L), T = 273.15 K

  • Calculate: n = (101,325 × 0.02241) / (8.314 × 273.15)

  • n = 2270.69 / 2270.96 ≈ 1.000 mol

  • This is the textbook definition of molar volume at STP.
  • Case 2 — Pressurized Nitrogen Tank


  • Given: P = 506,625 Pa (5 atm), V = 0.010 m³ (10 L), T = 298.15 K (25°C)

  • Calculate: n = (506,625 × 0.010) / (8.314 × 298.15)

  • n = 5066.25 / 2478.82 ≈ 2.044 mol

  • At 5 atm, the same 10 L tank holds ~5× more moles than at 1 atm — consistent with Boyle's Law.
  • Case 3 — CO₂ from Dry Ice Sublimation


  • Given: P = 101,325 Pa, V = 0.500 m³ (500 L), T = 293.15 K (20°C)

  • Calculate: n = (101,325 × 0.500) / (8.314 × 293.15)

  • n = 50,662.5 / 2437.36 ≈ 20.79 mol

  • Mass = 20.79 mol × 44.01 g/mol ≈ 915 g of CO₂ — useful for estimating dry ice sublimation in a confined space.
  • ---

    Common Errors

    1. Using Celsius instead of Kelvin for T. The gas law requires absolute temperature. Using T = 25°C instead of 298.15 K inflates the denominator error — at 25°C vs 298.15 K, results differ by a factor of ~12×. Always add 273.15.

    2. Mixing pressure units (atm or psi instead of Pa). If you enter P = 1 instead of P = 101,325, your result for n will be off by a factor of 101,325. Convert everything to SI units (Pa, m³, K) before calculating.

    3. Using liters instead of cubic meters for V. 22.4 L ≠ 22.4 m³. Divide liters by 1,000 to get m³. Failing to do so overestimates n by a factor of 1,000.

    4. Assuming real gases behave ideally at high pressures. Above ~10 atm or near the gas's boiling point, intermolecular forces cause significant deviation. Use the van der Waals equation [P + a(n/V)²][V − nb] = nRT for real gas corrections. For air at 300 atm, the ideal law overestimates n by >5%.

    5. Using the wrong value of R. R has different numerical values depending on units: 8.314 J·mol⁻¹·K⁻¹ (SI), 0.08206 L·atm·mol⁻¹·K⁻¹, or 62.364 L·mmHg·mol⁻¹·K⁻¹. Mixing R with incompatible units gives completely wrong results.

    ---

    Related Calculators

    Explore other science and chemistry tools on Hacé Cuentas:

  • Molar mass and stoichiometry calculations: useful for converting moles (n) to grams once you have your result from PV=nRT.

  • Unit converter for pressure, temperature, and volume: quickly switch between atm, Pa, bar, psi, °C, K, L, and m³ before entering values here.
  • Frequently asked questions

    What is the universal gas constant R and where does its value come from?

    R = 8.314462618 J·mol⁻¹·K⁻¹, defined exactly since the 2019 SI redefinition of base units (NIST CODATA 2018). It equals the product of Boltzmann's constant (k_B = 1.380649×10⁻²³ J/K) and Avogadro's number (Nₐ = 6.02214076×10²³ mol⁻¹). In non-SI units it becomes 0.082057 L·atm·mol⁻¹·K⁻¹ or 1.987 cal·mol⁻¹·K⁻¹.

    What is the difference between STP and NTP, and which should I use?

    STP (Standard Temperature and Pressure) is 0°C (273.15 K) and 100,000 Pa (1 bar) per the 1982 IUPAC definition — giving a molar volume of 22.711 L/mol. The older pre-1982 STP used 101,325 Pa (1 atm), yielding 22.414 L/mol, still common in many textbooks. NTP (Normal Temperature and Pressure) is 20°C (293.15 K) and 1 atm — molar volume 24.055 L/mol. When in doubt, check which standard your course or datasheet specifies.

    When does the Ideal Gas Law break down and become inaccurate?

    The ideal gas approximation fails at high pressures (>10–20 atm) and low temperatures near the gas's condensation point, where intermolecular attractions and molecular volume become significant. For example, CO₂ at 40 atm and 0°C shows a ~7% deviation from ideal behavior. In these cases, the van der Waals equation or other equations of state (Redlich-Kwong, Peng-Robinson) should be used instead.

    Can I solve for pressure, volume, or temperature instead of moles?

    Yes — PV = nRT can be rearranged for any single unknown: P = nRT/V, V = nRT/P, T = PV/(nR). Simply ensure all known values are in SI units (Pa, m³, K, mol) before rearranging. This calculator specifically solves for n (moles), but the same formula applies by substitution for any of the four variables.

    How do I convert common pressure units to Pascals for this calculator?

    Key conversions: 1 atm = 101,325 Pa; 1 bar = 100,000 Pa; 1 psi = 6,894.76 Pa; 1 mmHg (torr) = 133.322 Pa; 1 kPa = 1,000 Pa. For example, a 5 atm tank is 5 × 101,325 = 506,625 Pa. Always use absolute pressure (not gauge pressure) — add atmospheric pressure (~101,325 Pa) to gauge readings.

    How many molecules are in 1 mole of an ideal gas?

    Exactly 6.02214076×10²³ molecules (Avogadro's number, Nₐ), a defined constant since the 2019 SI revision. So at STP (273.15 K, 1 atm), 22.414 liters of any ideal gas contains 6.022×10²³ molecules, whether it's H₂, O₂, or CH₄ — a direct consequence of Avogadro's Law and the ideal gas model.

    Is the Ideal Gas Law applicable to gas mixtures like air?

    Yes — for ideal gas mixtures, Dalton's Law of Partial Pressures applies: P_total = P₁ + P₂ + P₃ + …, and n_total = n₁ + n₂ + n₃ + …. Dry air at 1 atm behaves very close to an ideal gas at normal temperatures. You can use PV = nRT with P_total to find total moles, then use mole fractions (e.g., O₂ ≈ 20.95%, N₂ ≈ 78.09%) to find individual component amounts.

    Why does a balloon shrink in the cold? How does the Ideal Gas Law explain it?

    At constant pressure (P) and constant moles (n), the ideal gas law gives V = nRT/P — volume is directly proportional to absolute temperature (Charles's Law). Dropping from 298 K (25°C) to 258 K (−15°C) reduces volume by a factor of 258/298 ≈ 0.866, so a 1 L balloon shrinks to about 0.87 L — roughly a 13% reduction. This is why car tires lose pressure in winter (temperature drop lowers both pressure and effective volume).

    Sources and references