Skip to main content

Ideal Gas Law Calculator: Solve P, V, n, T (PV=nRT)

Solve PV=nRT for any variable, use the combined gas law, calculate partial pressures, density, and compare real gas behavior with interactive charts.

Quick Reference

STP Conditions

T = 273.15 K (0°C)
P = 1 atm = 101.325 kPa
V_m = 22.4 L/mol

Gas Constant R

0.082057 L·atm/(mol·K)
8.314 J/(mol·K)
62.364 L·Torr/(mol·K)

Key Equations

PV = nRT
P₁V₁/T₁ = P₂V₂/T₂
P_total = Σ P_i

Solve Any Variable (P, V, n, T)

If you're plugging numbers into an ideal gas law calculator and the pressure comes out as 0.003 atm for a balloon at room temperature, something went wrong with your units. PV = nRT has four variables—pressure, volume, moles, and temperature—and you can solve for whichever one you're missing. The algebra is just division: P = nRT/V, V = nRT/P, n = PV/(RT), T = PV/(nR). The hard part isn't the math. It's making sure every value is in the right unit before you touch the calculator.

The most common error is using Celsius for temperature. PV = nRT requires absolute temperature in kelvin. Plug in 25 (meaning 25 °C) instead of 298 K, and your answer is off by a factor of about 12. The equation breaks entirely at 0 °C if you forget to convert, because T = 0 makes the right side zero regardless of P, V, or n. Kelvin exists precisely to avoid this—its zero point is absolute zero, where molecular motion stops.

Once you solve for the unknown, check the result against intuition. One mole of gas at STP (273.15 K, 1 atm) occupies 22.4 L. If your answer gives 0.5 mol occupying 200 L at 1 atm and 300 K, that's suspiciously large—roughly 4× what you'd expect. Sanity checks like this catch unit errors, misplaced decimals, and wrong R values before you submit.

Unit Consistency Warnings

The gas constant R has the same physical meaning in every unit system, but its numerical value changes depending on which pressure and volume units you use. R = 0.08206 L·atm/(mol·K) only works when P is in atm and V is in liters. Use kPa for pressure with that R, and your answer is wrong by a factor of 101.325. Use mL instead of L, and you're off by 1000.

Here are the R values you'll encounter most often: 0.08206 L·atm/(mol·K) for atm + L, 8.314 J/(mol·K) or equivalently 8.314 kPa·L/(mol·K) for kPa + L or Pa + m³, and 62.36 L·mmHg/(mol·K) for mmHg + L. Pick the R that matches your given units. If your problem gives pressure in bar, use R = 0.08314 L·bar/(mol·K). Dimensional analysis catches mismatches: write out every unit and cancel. If the result doesn't reduce to the target unit, your R is wrong.

Volume trips people up less often, but watch for mL vs L and cm³ vs m³. One cubic meter is 1000 liters, not 100. If your textbook gives volume in cm³ (which equals mL), convert to L before using R = 0.08206. And never use Fahrenheit—convert to Celsius first, then add 273.15 to get kelvin. Two conversions, zero shortcuts.

Combined Gas Law Mode

When the amount of gas stays fixed (sealed container, no leaks), you can compare two states without knowing n or R at all. The combined gas law P₁V₁/T₁ = P₂V₂/T₂ falls out of PV = nRT because nR cancels on both sides. You fill in the initial state (subscript 1), the final state (subscript 2), and solve for the one missing value.

This is what you use for "before and after" problems: a gas at 2.0 atm, 300 K, 5.0 L is heated to 450 K at constant pressure—find the new volume. Constant pressure means P₁ = P₂, so they cancel: V₁/T₁ = V₂/T₂. V₂ = V₁ × T₂/T₁ = 5.0 × (450/300) = 7.5 L. If pressure also changes, keep all six variables and solve algebraically.

The combined law also contains Boyle's law (constant T: P₁V₁ = P₂V₂), Charles's law (constant P: V₁/T₁ = V₂/T₂), and Gay-Lussac's law (constant V: P₁/T₁ = P₂/T₂) as special cases. You don't need to memorize each separately—just use P₁V₁/T₁ = P₂V₂/T₂ and cancel whatever's held constant. Label your states clearly ("State 1: before heating", "State 2: after heating") so you never mix initial and final values.

Density & Molar Mass from PV=nRT

Replace n with m/M (mass divided by molar mass) in PV = nRT, and rearrange: d = PM/(RT), where d is gas density in g/L. This is useful in two directions. Given a known gas and conditions, calculate its density. Or given measured density at known T and P, solve for molar mass: M = dRT/P. The second version is how chemists historically identified unknown gases.

At STP (273.15 K, 1 atm), any ideal gas has density d = M/22.414 g/L. For O₂ (M = 32.00 g/mol), d = 32.00/22.414 = 1.428 g/L. For He (M = 4.003 g/mol), d = 0.1786 g/L. Helium's density is about 7% that of air (average M ≈ 29 g/mol), which is why helium balloons float. If your density calculation gives a heavier-than-air number for helium, check your M or your units.

When using d = PM/(RT) with R = 0.08206, pressure must be in atm, M in g/mol, and T in kelvin. The density comes out in g/L. If you want kg/m³ instead, multiply by 1 (since 1 g/L = 1 kg/m³). But if you accidentally use R = 8.314 (Pa·m³ units), then P must be in Pa, M in kg/mol, and density comes out in kg/m³. Mixing unit systems gives nonsense—always trace through dimensional analysis.

R Value Selection

Which R should I use? Match R to whatever pressure and volume units you have. R = 0.08206 L·atm/(mol·K) is the standard for general chemistry. If your pressure is in kPa, use R = 8.314 kPa·L/(mol·K). If mmHg (Torr), R = 62.36 L·mmHg/(mol·K). If bar, R = 0.08314 L·bar/(mol·K). Temperature is always kelvin regardless of which R you pick.

Does R = 8.314 J/(mol·K) work for PV = nRT? Yes, but only when P is in pascals and V is in m³, because 1 J = 1 Pa·m³. This version appears in thermodynamics and physical chemistry more often than in general chemistry. If you use it with liters and atmospheres, you'll be off by 101,325.

Can I convert units instead of switching R? Absolutely. If your problem gives P = 152 kPa, you can convert to atm (152/101.325 = 1.50 atm) and use R = 0.08206. Or leave P in kPa and use R = 8.314. Either path gives the same answer. The only rule: every unit in P, V, T must match R. One mismatch and the number is garbage.

What about the calorie version? R = 1.987 cal/(mol·K) shows up in thermochemistry when energies are given in calories. It's the same R, just in calorie-based energy units. You wouldn't use this for PV = nRT gas calculations—it's for ΔG = −RT ln K when ΔG is in cal/mol. Using the wrong R in thermodynamic equations is just as destructive as using the wrong R in gas law equations.

Gas Law Q&A

When does the ideal gas law fail? At high pressures (above ~10 atm) and low temperatures (near the boiling point of the gas). Under these conditions, gas molecules are close enough that their physical volume and intermolecular attractions matter. The van der Waals equation [P + a(n/V)²](V − nb) = nRT corrects for both effects using gas-specific constants a (attraction) and b (molecular volume). For typical homework problems at 1–5 atm and 273–400 K, the ideal gas law is accurate to within a few percent.

Why can't I use PV = nRT for liquids? The equation assumes freely moving particles with negligible volume and no persistent interactions. Liquids have strong intermolecular forces and essentially fixed density. Water at 25 °C and 1 atm has a molar volume of 0.018 L/mol, but PV = nRT predicts 24.5 L/mol for the same conditions. That's off by a factor of 1400. The ideal gas law applies only to the gas phase.

Does PV = nRT work for gas mixtures? Yes. Each gas in a mixture independently obeys PV = nRT using its own moles: PiV = niRT. The total pressure is the sum of all partial pressures (Dalton's law). The total moles give total pressure: PtotalV = ntotalRT. This works because ideal gas particles don't interact, so each species behaves as if the others aren't there.

PV=nRT Framework

• Solve for P: P = nRT/V. Use when volume, moles, and temperature are known.

• Solve for V: V = nRT/P. Use when pressure, moles, and temperature are known.

• Solve for n: n = PV/(RT). Use when pressure, volume, and temperature are known. Convert grams to moles first if given mass.

• Solve for T: T = PV/(nR). Result is always in kelvin. Subtract 273.15 to convert back to °C if needed.

• Combined law: P₁V₁/T₁ = P₂V₂/T₂. Fixed amount of gas, two states. Cancel whichever variable is held constant.

• Density form: d = PM/(RT). Links gas density to molar mass at known T and P. Rearrange to M = dRT/P for unknown molar mass.

• STP reference: 273.15 K, 1 atm. Molar volume = 22.414 L/mol. Quick sanity check for any gas calculation.

Unknown Pressure Walkthrough

Problem: A rigid 12.0 L steel cylinder contains 0.50 mol of N₂ at 22 °C. Find the pressure inside the cylinder.

Step 1: Convert temperature to kelvin

T = 22 + 273.15 = 295.15 K

Step 2: Choose R

V is in L, want P in atm → R = 0.08206 L·atm/(mol·K)

Step 3: Solve P = nRT/V

P = (0.50)(0.08206)(295.15) / 12.0

P = 12.11 / 12.0 = 1.01 atm

Step 4: Sanity check

0.50 mol at STP occupies ~11.2 L.

Here V = 12.0 L at 295 K (slightly above STP T).

P ≈ 1 atm makes sense—close to STP conditions.

The sanity check confirms the result. If we had forgotten to convert 22 °C to kelvin and used T = 22 directly, we'd get P = (0.50)(0.08206)(22)/12.0 = 0.075 atm—a near vacuum inside a sealed cylinder at room temperature, which is physically absurd. That's why the kelvin conversion matters every single time.

Sources

Frequently Asked Questions

What is the Ideal Gas Law and when is it accurate?

The Ideal Gas Law (PV = nRT) describes the relationship between pressure, volume, amount, and temperature for an ideal gas. It's most accurate for gases at low pressure, high temperature, and when molecules have negligible volume and interactions. At room temperature and 1 atm, most gases (N₂, O₂, He, Ar) behave nearly ideally. The law breaks down at high pressures or low temperatures where real gas effects become significant.

How do I choose the right gas constant R?

The gas constant R has different numerical values depending on units. Common values: 0.082057 L·atm/(mol·K), 8.314462618 J/(mol·K) or Pa·m³/(mol·K), 62.364 L·Torr/(mol·K), 1.987 cal/(mol·K). The calculator automatically picks the correct R based on your pressure and volume units. Always ensure your temperature is in Kelvin (K = °C + 273.15).

What is the Combined Gas Law and when should I use it?

The Combined Gas Law (P₁V₁/T₁ = P₂V₂/T₂) relates two states of the same gas sample with constant amount (n). Use it when a gas undergoes a change in conditions—e.g., heating a balloon, compressing a piston, or moving a gas cylinder to a different altitude. It's derived from the Ideal Gas Law by canceling out n and R, which remain constant.

How do partial pressures work in gas mixtures (Dalton's Law)?

Dalton's Law states that the total pressure of a gas mixture equals the sum of partial pressures: P_total = Σ P_i. Each component's partial pressure is P_i = y_i × P_total, where y_i is the mole fraction. This applies to ideal gas mixtures where molecules don't interact. Use it for air composition, scuba diving gas blends, or any mixture analysis. Mole fractions must sum to 1.0.

When do I need the van der Waals equation for real gases?

Use the van der Waals equation when ideal gas assumptions fail—typically at high pressures (>10 atm), low temperatures (near condensation), or for polar/large molecules. The equation accounts for molecular volume (b parameter) and intermolecular attractions (a parameter). For example, CO₂ deviates ~3% from ideal at 10 atm and 300 K. Common a, b values: N₂ (1.39, 0.0391), CO₂ (3.64, 0.0427), H₂O (0.545, 0.0305) in L²·bar/mol² and L/mol units.

What is the ideal gas law in simple terms?

In simple terms, PV = nRT says that if you know any three of pressure (P), volume (V), amount of gas (n in moles), and temperature (T in Kelvin), you can calculate the fourth. It's like a recipe: more gas (higher n) or higher temperature increases pressure if volume stays fixed. Bigger volume gives lower pressure if amount and temperature stay constant. It's the fundamental relationship for understanding gas behavior in chemistry and physics.

Why do I have to use Kelvin for temperature?

The ideal gas law requires absolute temperature (Kelvin) because the relationship is proportional—doubling temperature (in K) doubles pressure at constant volume. Celsius and Fahrenheit have arbitrary zero points (0°C = 273.15 K), so they don't work in the equation. Always convert: K = °C + 273.15. For example, 25°C = 298.15 K. Using Celsius directly would give completely wrong answers because PV ≠ nR(°C).

Which R value should I use for my calculation?

Choose R based on your pressure and volume units. If using atm and liters, use R = 0.08206 L·atm/(mol·K). For pascals (Pa) and cubic meters (m³), use R = 8.314 J/(mol·K) = 8.314 Pa·m³/(mol·K). For torr and liters, use R = 62.364 L·Torr/(mol·K). Our calculator automatically selects the correct R when you choose your units, so you don't have to worry about it—just ensure all your units are consistent.

When does the ideal gas law break down?

The ideal gas law breaks down under conditions where gas molecules interact significantly or occupy appreciable volume: (1) High pressures (>10 atm) where molecules are forced close together, (2) Low temperatures near the condensation point where intermolecular forces dominate, (3) Polar or large molecules (NH₃, H₂O, CO₂) that attract each other strongly. In these cases, use the van der Waals equation or other real gas models. For most everyday chemistry at ~1 atm and room temperature, ideal gas law works great.

Can I use this calculator for high-pressure gases?

You can use it, but be aware of increasing error at high pressures. At pressures above 10 atm, real gas effects (molecular volume, intermolecular forces) become significant. For example, nitrogen at 100 atm and 300 K deviates ~10% from ideal behavior. The calculator includes a van der Waals real gas mode that corrects for these effects using empirical constants (a, b) for different gases. For critical applications at high pressure, always use real gas corrections.

How do I convert grams to moles for the calculator?

To convert grams to moles, divide the mass by the molar mass: n (mol) = mass (g) / molar mass (g/mol). Find molar mass by adding atomic masses from the periodic table. For example, CO₂ has molar mass 44.01 g/mol (C: 12.01 + O₂: 2×16.00). So 88 g CO₂ = 88/44.01 = 2.0 mol. You can use our Molar Mass Calculator to find molar mass for any compound, then use that value here.

What is STP and why is it important?

STP (Standard Temperature and Pressure) is a reference condition: 273.15 K (0°C) and 1 atm (101.325 kPa). At STP, one mole of any ideal gas occupies 22.4 liters—this is the molar volume. STP is crucial for comparing gas properties and doing stoichiometry calculations. For example, 2 moles of N₂ at STP occupy 44.8 L. Note: Some sources use 'standard conditions' at 25°C and 1 bar (100 kPa), where molar volume is 24.8 L, so always check which standard is being used.

Explore More Chemistry Calculators

Discover our complete suite of chemistry tools for equations, thermodynamics, solutions, and more

Browse All Chemistry Tools
Ideal Gas Law Calculator: Solve P, V, n, T (PV=nRT)