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
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.
Pressure and volume on one side always balance moles, R, and temperature on the other.
When to Use PV = nRT
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
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?
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.