Ideal Gas Law Calculator: Solve PV = nRT for Pressure, Volume, Moles, or Temperature
Understand the ideal gas law PV = nRT, the gas constant R, when the ideal gas assumption applies, and how to solve for any unknown variable with worked examples.
What Is the Ideal Gas Law Calculator?
The ideal gas law calculator solves the equation PV = nRT for any one of its four variables — pressure (P), volume (V), amount in moles (n), or temperature (T) — given the other three. The ideal gas law is one of the most important equations in chemistry and physics, describing the behavior of a hypothetical 'ideal' gas whose particles have negligible volume and exert no intermolecular forces on each other.
The law consolidates three earlier empirical gas laws. Boyle's Law (1662) established that pressure and volume are inversely proportional at constant temperature: P ∝ 1/V. Charles's Law (1787) showed that volume and absolute temperature are directly proportional at constant pressure: V ∝ T. Avogadro's Law (1811) stated that equal volumes of gas at the same temperature and pressure contain the same number of molecules, so V ∝ n. Combining these three relationships gives PV = nRT.
The universal gas constant R = 8.31446 J/(mol·K) in SI units. For calculations involving pressure in atmospheres and volume in litres, the common form R = 0.082057 L·atm/(mol·K) is used. The calculator uses this latter form. Temperature must always be in Kelvin (K = °C + 273.15) because the law requires absolute temperature — inserting Celsius values produces physically meaningless results.
Real gases deviate from ideal behavior at high pressures (where intermolecular distances shrink and particle volumes matter) and low temperatures (where intermolecular attractions become significant relative to kinetic energy). The van der Waals equation corrects for these deviations using empirical constants a and b unique to each gas. For most introductory chemistry problems and for gases at room temperature and moderate pressures, the ideal gas law is accurate to within a few percent.
STP (Standard Temperature and Pressure) is defined by IUPAC as 0 °C (273.15 K) and 100 kPa (≈ 0.9869 atm). At STP, one mole of ideal gas occupies 22.414 L — the molar volume of an ideal gas, a useful reference figure. Note that older texts use 1 atm rather than 100 kPa as the standard pressure, giving a slightly different molar volume of 22.711 L.
Key Parameters & Input Variables
- Absolute Pressure (P in atm, bar, kPa, Pa, psi, Torr): Force per unit area exerted by gas collisions on container walls; gauge readings must be shifted by P_abs = P_gauge + P_atm.
- Container Volume (V in L, mL, m³, ft³) & Molar Volume (V_m = V/n): Macroscopic gas space; 1 mole occupies 22.7110 L at IUPAC STP (0°C, 1 bar) and 22.4140 L at NIST STP (0°C, 1 atm).
- Molar Quantity (n = m / M in mol) & Gas Density (ρ = PM / RT in g/L): Links chemical moles to gravimetric mass in grams via IUPAC molar mass M (g/mol).
- Thermodynamic Temperature (T in Kelvin, K = °C + 273.15): Directly proportional to mean translational kinetic energy E_k = (3/2)RT per mole.
- Universal Gas Constant (R = N_A · k_B): Exact 2019 SI value R = 8.314462618 J·mol⁻¹·K⁻¹ = 0.082057366 L·atm·mol⁻¹·K⁻¹ = 62.363598 L·Torr·mol⁻¹·K⁻¹.
Common Use Cases & Applications
- Finding the pressure exerted by a known amount of gas in a fixed container at a given temperature.
- Determining the volume a gas sample will occupy after a temperature or pressure change.
- Calculating the number of moles (and therefore mass) of gas in a container from measurable P, V, T values.
- Converting between standard conditions and experimental conditions for laboratory gas measurements.
- Solving combined gas law problems where two or more variables change simultaneously.
- Estimating gas density from molar mass, pressure, and temperature using the derived form ρ = PM/(RT).
- Checking whether a gas cylinder has leaked by comparing the expected pressure to the measured value.
- Designing reaction vessels for gas-phase chemistry where stoichiometry and containment volume must match.
Mathematical Formula
To solve the ideal gas law, isolate the unknown variable algebraically before substituting numbers. For pressure: P = nRT/V. For volume: V = nRT/P. For moles: n = PV/(RT). For temperature: T = PV/(nR). Ensure consistent units before substituting: pressure in atm, volume in litres, temperature in Kelvin, and n in moles when using R = 0.082057 L·atm/(mol·K).
Unit conversions are the most common source of error. Pressure may be given in kPa (÷ 101.325 to convert to atm), mmHg or torr (÷ 760 for atm), or psi (÷ 14.696 for atm). Volume may be given in mL (÷ 1000 for litres) or cm³ (also ÷ 1000). Temperature must be converted from Celsius to Kelvin by adding 273.15. Never add 273 without the decimal if more than three significant figures are required.
For combined gas law problems where initial and final states are compared for a fixed amount of gas (n constant), the relationship P₁V₁/T₁ = P₂V₂/T₂ is more efficient than applying the full ideal gas law twice. This form eliminates R and n entirely, requiring only the ratio of states. The calculator handles the single-state form (PV = nRT) and you can use it twice — once for each state — to solve combined gas law scenarios.
Gas density can be derived from the ideal gas law: since n = mass/M (where M is molar mass in g/mol) and density ρ = mass/V, substitution gives ρ = PM/(RT). This form lets you calculate the density of any gas at any temperature and pressure without needing a sample to weigh, or conversely, determine the molar mass of an unknown gas from its measured density.
Primary Governing Equation
P·V = n·R·T; ρ = (P·M)/(R·T); P₁V₁/(n₁T₁) = P₂V₂/(n₂T₂); P_total = ∑ P_i
CODATA 2018 / IUPAC Ideal Gas Equation of State (R = 8.314462618 J·mol⁻¹·K⁻¹ = 0.082057366 L·atm·mol⁻¹·K⁻¹), gas density & Dumas molar mass solver, two-state combined thermodynamic work balance, and Dalton partial pressure law.
Ideal Gas Law
PV = nRT
P in atm, V in litres, n in moles, R = 0.082057 L·atm/(mol·K), T in Kelvin.
Pressure
P = nRT / V
Calculates pressure in atm given moles, temperature (K), and volume (L).
Volume
V = nRT / P
Calculates volume in litres given moles, temperature (K), and pressure (atm).
Moles
n = PV / (RT)
Calculates the amount of gas in moles given pressure, volume, and temperature.
Temperature
T = PV / (nR)
Calculates temperature in Kelvin given pressure, volume, and moles.
Gas Density
ρ = PM / (RT)
Density (g/L) of an ideal gas where M is molar mass (g/mol).
Step-by-Step Calculation Guide
- Step 1: A 2.50 L rigid container holds 0.120 mol of nitrogen gas (N₂). What pressure does it exert at 25 °C?
- Step 2: Convert temperature to Kelvin: T = 25 + 273.15 = 298.15 K. Identify the known values: n = 0.120 mol, R = 0.082057 L·atm/(mol·K), T = 298.15 K, V = 2.50 L.
- Step 3: Apply the pressure formula: P = nRT / V = (0.120 × 0.082057 × 298.15) / 2.50 = (2.9358) / 2.50 = 1.174 atm.
- Step 4: To verify with a second approach: at STP (273.15 K, 1 atm), 0.120 mol would occupy 0.120 × 22.414 = 2.690 L. At 25 °C the volume expands proportionally: 2.690 × (298.15/273.15) = 2.937 L. In a 2.50 L container, the pressure must be higher than 1 atm by the ratio 2.937/2.50 = 1.175 atm — confirming our direct calculation within rounding.
- Step 5: Converting to other pressure units: 1.174 atm × 101.325 kPa/atm = 118.9 kPa; 1.174 × 760 mmHg/atm = 892 mmHg.
Sensitivity Analysis & Edge-Case Behavior
Because pH and pKa operate on a base-10 logarithmic scale, a 1.0 unit change in pH represents a 10-fold (1,000%) change in hydrogen ion concentration $[\text{H}^+]$, and a 2.0 unit shift represents a 100-fold concentration change.
Common Pitfalls & Errors to Avoid
- Confusing Molarity (moles of solute per liter of total solution, M) with Molality (moles of solute per kilogram of solvent, m).
- Forgetting to balance stoichiometric reaction coefficients before computing mole-to-mole limiting reagent ratios.
Institutional & Industry Applications
Analytical & Pharmaceutical Laboratories: Preparing calibrated volumetric reagents, titrations, and HPLC mobile phases.
Chemical Engineering & Process Control: Scaling batch reactor stoichiometry, thermodynamic heat balances, and yield efficiency.
Chemistry Education & AP/University Coursework: Verifying general, organic, and physical chemistry problem sets.
Expert Tips & Best Practices
- Always convert solution volumes from milliliters (mL) to liters (L) before applying the Molarity equation ($M = \text{moles} / \text{Liters}$).
- In gas law and thermodynamic equations ($PV = nRT$, $\Delta G = \Delta H - T\Delta S$), temperature must always be entered in absolute Kelvin ($K = ^\circ\text{C} + 273.15$), never Celsius.
Frequently Asked Questions
How do you solve for Pressure (P), Volume (V), Moles (n), or Temperature (T) using PV = nRT?
Rearrange the Ideal Gas Law PV = nRT for your unknown variable: Pressure P = nRT/V, Volume V = nRT/P, Moles n = PV/(RT), or Temperature T = PV/(nR). Ensure temperature is converted to absolute Kelvin (K = °C + 273.15) and that the units of P and V match your chosen gas constant R (for example, R = 0.082057366 L·atm/(mol·K) when P is in atm and V is in liters, or R = 8.314462618 L·kPa/(mol·K) when P is in kPa).
What is the difference between IUPAC STP (22.71 L/mol) and NIST / textbook STP (22.41 L/mol)?
Both conventions define Standard Temperature as 273.15 K (0 °C), but differ in Standard Pressure. Since 1982, IUPAC defines standard pressure as exactly 1 bar (100 kPa), giving an ideal molar volume V_m = RT/P = 22.71095 L/mol. Legacy US textbooks and NIST definitions use 1 standard atmosphere (101.325 kPa), giving V_m = 22.41397 L/mol. At Standard Ambient Temperature and Pressure (SATP: 298.15 K / 25 °C and 1 bar), V_m equals 24.78957 L/mol.
How do you calculate gas density (ρ) and unknown molar mass (M) from the Ideal Gas Law?
Substitute n = m / M (mass divided by molar mass) into PV = nRT to get PV = (m/M)RT. Rearranging for density ρ = m / V gives ρ = (P · M) / (R · T) in g/L. Conversely, in a Dumas bulb vapor density experiment where a known mass m of vapor fills volume V at pressure P and temperature T, the unknown molar mass is M = (m · R · T) / (P · V) = (ρ · R · T) / P.
When does a real gas deviate from the Ideal Gas Law PV = nRT?
Real gases deviate from PV = nRT at high pressures (typically P > 10 bar, where molecular volume nb becomes a non-negligible fraction of container volume V) and at low temperatures approaching the gas's critical temperature T_c (where intermolecular Van der Waals attractive forces −an²/V² reduce wall impact pressure). The Van der Waals equation [P + a(n/V)²](V − nb) = nRT and compressibility factor Z = PV/(nRT) quantify these non-ideal deviations.