Ideal Gas Law Calculator (PV = nRT)

Solve PV = nRT for pressure, volume, moles, or temperature. Leave one field blank, enter the other three, and get an instant result with full step-by-step working. The gas constant R is built in automatically.

Ideal Gas Law Solver

Gas constant used: R = 8.314462618 J/(mol·K)

What Is the Ideal Gas Law?

The ideal gas law, PV = nRT, is the single equation that unifies Boyle's, Charles', Gay-Lussac's, and Avogadro's Laws into one relationship. It models a hypothetical "ideal" gas made of point particles with no volume and no attraction to one another, an approximation that real gases like air, nitrogen, and helium follow remarkably closely under normal conditions.

Each variable plays a distinct role: P is pressure, V is volume, n is the amount of gas in moles, R is the universal gas constant, and T is absolute temperature. Because it contains all four measurable gas properties in one equation, it can answer questions the combined gas law cannot. Like finding out exactly how many moles of gas are present in a container, given only its pressure, volume, and temperature.

If you are comparing the same fixed amount of gas between two states, the combined gas law is usually simpler since R cancels out. Use PV = nRT specifically when the number of moles is unknown, changing, or the quantity you need to find.

The Four Variables of PV = nRT P · V n · R · T =

Pressure and volume on one side always balance moles, R, and temperature on the other.

When to Use PV = nRT

One State, Four Unknowns Single container P, V n, T Know any 3 → find the 4th

PV = nRT works with a single snapshot, no "before and after" comparison required.

A chemist filling a rigid gas cylinder to a known pressure and temperature can use PV = nRT to calculate exactly how many moles, and therefore how many grams, of gas the cylinder holds, once the gas's molar mass is known.

An engineer sizing a compressed-air storage tank can rearrange the equation to find the volume needed to hold a required number of moles of gas at a target pressure and temperature, directly informing tank dimensions.

A student given a gas's mass, molar mass, container volume, and temperature can find its pressure without ever needing a second state to compare against. Which is precisely the situation where the combined gas law cannot help, but PV = nRT can.

How the Calculator Works

1. Pick the unknown
Select P, V, n, or T as the value you want solved.
2. Fill in the rest
Enter the other three values in any supported unit. R is applied automatically.
3. Get instant results
The answer and a full substitution walkthrough appear immediately.

Worked Example: Finding Moles from PV = nRT

Problem: A 12.0 L gas cylinder holds gas at 4.50 atm and 22°C. How many moles of gas are inside?

Given: P = 4.50 atm, V = 12.0 L, T = 22°C = 295.15 K. Use R = 0.082057 L·atm/(mol·K). n = PV / (RT) n = (4.50 × 12.0) / (0.082057 × 295.15) n ≈ 2.23 mol

If this were oxygen gas (molar mass 32.00 g/mol), that would correspond to about 2.23 × 32.00 ≈ 71.4 grams of O₂ in the cylinder, a calculation chemists perform constantly when preparing gas samples of a known mass from a pressurized source.

Common Mistakes When Applying PV = nRT

The single most common error is using a value of R that doesn't match the pressure and volume units in the problem, mixing R = 8.314462618 J/(mol·K) with pressure in atm and volume in liters, for example, produces a badly wrong answer, since that value of R specifically expects pascals and cubic meters. Always match R to your units, or convert your units to match a value of R you already know; see the Gas Constant (R) page for a full conversion table.

A second mistake is forgetting to convert temperature to Kelvin. PV = nRT requires absolute temperature just as strictly as the individual gas laws do, and plugging in a Celsius value will give a wrong result even if every other unit is handled correctly.

A third pitfall is confusing the ideal gas law with the combined gas law. If you're comparing the same fixed amount of gas between two states and don't actually need to know the number of moles, the combined gas law is simpler since R cancels out entirely. Reach for PV = nRT specifically when you need to find moles (or a mass, via molar mass) or when you only have data for a single state rather than a before-and-after comparison.

Ideal Gas Law FAQ

What is the ideal gas law?
The ideal gas law is PV = nRT, relating pressure (P), volume (V), amount of gas in moles (n), and absolute temperature (T) through the universal gas constant R (8.314462618 J/(mol·K)). It describes how an idealized gas, one with no intermolecular forces and negligible molecular volume, behaves under any combination of these four variables, and it reduces to Boyle's, Charles', Gay-Lussac's, and Avogadro's Laws as special cases.
How is PV = nRT different from the combined gas law?
The combined gas law, P₁V₁/T₁ = P₂V₂/T₂, compares one fixed amount of gas between two different states. The ideal gas law, PV = nRT, is a single-state equation that also brings in the number of moles, letting you find the amount of gas directly, or work with just one state instead of a before/after comparison. Use the combined gas law when moles are unchanging and you're comparing two states; use PV = nRT when moles matter or you only have one state's data.
What is the value of R, the gas constant?
The most common SI value is R = 8.314462618 joules per mole-kelvin (J/(mol·K)), used when pressure is in pascals and volume is in cubic meters. Other unit systems use different numeric values of R, such as 0.082057 L·atm/(mol·K) for pressure in atmospheres and volume in liters. This calculator always uses the SI value internally and converts your chosen units automatically. See our dedicated Gas Constant (R) page for a full table of R in different unit systems.
Can I solve for moles (n) with this calculator?
Yes: select 'Solve for n' and enter pressure, volume, and temperature; the calculator computes n = PV/(RT) automatically. This is one of the most common uses of the ideal gas law: finding out how much gas (in moles, and from there in grams using molar mass) is present in a container of known size, pressure, and temperature.
What units does this calculator support?
Pressure: Pa, kPa, MPa, bar, mbar, atm, mmHg, torr, psi, inHg. Volume: m³, L, mL, cm³, dm³, ft³, in³, gal (US). Temperature: Kelvin, Celsius, Fahrenheit, Rankine. Moles: mol, mmol, kmol. Mix any combination. The calculator converts everything to SI base units before applying PV = nRT.
Does the ideal gas law work for real gases like air or oxygen?
PV = nRT is an approximation that works very well for common gases like air, nitrogen, oxygen, and helium at ordinary temperatures and pressures, deviations only become significant at very high pressure or very low temperature, where intermolecular attractions and molecular size start to matter. For everyday chemistry, physics, and engineering calculations, it is accurate enough to be treated as exact.
How do I convert moles of gas to grams using this calculator?
Solve for n using PV = nRT, then multiply the result by the gas's molar mass (in g/mol) to get mass in grams: mass = n × M. For example, if this calculator gives n = 0.50 mol for a sample of oxygen gas (M = 32.00 g/mol), the mass would be 0.50 × 32.00 = 16.0 g.
What's a more accurate equation than PV = nRT for real gases at high pressure?
The van der Waals equation adds two correction terms to account for the finite size of gas molecules and the attractive forces between them: (P + a n²/V²)(V − nb) = nRT, where a and b are constants specific to each gas. It's more accurate at high pressure and low temperature, but far more complex to solve. PV = nRT remains the standard starting point for the vast majority of practical calculations.

Related Calculators