Article — Ideal Gas Law Calculator (PV = nRT)
Ideal gas law calculator (PV = nRT)
The ideal gas law is PV = nRT. Pressure times volume equals moles times the gas constant times absolute temperature. With three of the four variables, you can solve for the fourth — pressure, volume, moles, or temperature — using R = 0.082057 L·atm/(mol·K).
This single equation, derived from the work of Boyle, Charles, Gay-Lussac, and Avogadro between 1662 and 1811, describes how nearly every gas behaves under typical lab and industrial conditions. It underpins balloon physics, scuba diving math, the volumes used in stoichiometry, and the calibration of industrial gas tanks.
What is the ideal gas law?
The ideal gas law is an equation of state that relates pressure, volume, amount, and temperature of a gas assumed to consist of non-interacting point particles. It is exact for a hypothetical ideal gas and accurate to within about 1 percent for real gases at moderate conditions: pressures below 10 atm and temperatures well above the boiling point.
Three of the variables are intensive properties of the gas state (P, V, T) while n captures how much gas you have. Together they fully specify a gas sample. Know any three and the fourth is determined.
The ideal gas law was first written in its modern form by Émile Clapeyron in 1834, combining Boyle's law (1662), Charles's law (1787), and Avogadro's law (1811). The universal gas constant R wasn't given that exact name until the late 19th century.
The ideal gas law formula explained
PV = nRT looks simple but every symbol carries baggage. P is pressure in any consistent unit — atm, kPa, bar, or Pa, depending on the matching R. V is the volume occupied by the entire gas sample, not the molar volume. n is the amount in moles, where one mole equals 6.022 × 10²³ molecules.
P = nRT / VV = nRT / Pn = PV / (RT)T = PV / (nR)R is the constant tying it all together. In L·atm/(mol·K) units it equals 0.082057. T is absolute temperature in Kelvin — never Celsius, never Fahrenheit. This is the single most common source of error.
Solving PV = nRT for any variable
Worked example: 2 moles of nitrogen gas occupy a 10 L container at 300 K. What is the pressure?
P = nRT / V = (2 × 0.082057 × 300) / 10 = 4.92 atm. Pretty close to five atmospheres, well within the ideal regime.
Reverse the problem: you have nitrogen at 4.92 atm and 300 K in a 10 L tank. How many moles? n = PV / (RT) = (4.92 × 10) / (0.082057 × 300) = 2.0 moles. The math is symmetric — pick the unknown and isolate it.
The gas constant R and unit pairing
R is the conversion factor between pressure-volume energy and temperature-mole energy. It has the same numerical meaning regardless of unit system, but the digits change depending on units. Mismatched units are the second-most-common ideal gas law mistake.
- 0.082057 L·atm/(mol·K) — pair with atm and L.
- 8.314 J/(mol·K) — pair with Pa and m³.
- 0.08314 L·bar/(mol·K) — pair with bar and L.
- 62.364 L·mmHg/(mol·K) — pair with mmHg and L.
- 10.731 psi·ft³/(lbmol·°R) — pair with psi and ft³ (US engineering).
Using P in kPa with R = 0.082057 (which expects atm) gives an answer off by a factor of ~101. Always sanity-check the order of magnitude. If your gas mole count comes out around 100 or 0.01, you probably mismatched units.
Ideal gas law at STP
STP, Standard Temperature and Pressure, is a reference state used to compare gas volumes. The current IUPAC definition (since 1982) is 1 bar pressure and 273.15 K. Under those conditions one mole of an ideal gas occupies 22.711 liters.
The 22.4 L/mol figure that appears in older textbooks uses 1 atm rather than 1 bar. The difference is small — about 1.3 percent — but matters in precision work. Check which STP your problem is using.
Boyle's, Charles's, and Gay-Lussac's laws
Three special cases of PV = nRT show up constantly in physics and chemistry, each holding one set of variables constant.
- Boyle's law (constant T, n): P₁V₁ = P₂V₂. Squeeze a balloon, pressure rises.
- Charles's law (constant P, n): V₁/T₁ = V₂/T₂. Heat a balloon, it expands.
- Gay-Lussac's law (constant V, n): P₁/T₁ = P₂/T₂. Heat a sealed tank, pressure rises.
- Avogadro's law (constant P, T): V₁/n₁ = V₂/n₂. More gas, more volume.
- Combined gas law: P₁V₁/T₁ = P₂V₂/T₂. Rolls Boyle, Charles, and Gay-Lussac into one.
If a problem describes a gas changing state (heated, compressed, expanded) and the amount stays fixed, the combined gas law P₁V₁/T₁ = P₂V₂/T₂ is usually faster than computing PV = nRT twice.
When the ideal gas law fails
The two assumptions — point particles, no intermolecular forces — break down when molecules are close enough to interact. Three conditions push gas behavior away from ideal: high pressure, low temperature, and polar molecules like water vapor, ammonia, or carbon dioxide.
At 100 atm and room temperature, CO₂ deviates from ideal by about 5 percent. At 0 °C and 1 atm, water vapor deviates by similar amounts. For accurate work in these regimes, the van der Waals equation adds two correction terms for molecular volume and intermolecular attraction.
Common ideal gas law mistakes
Three errors account for most wrong answers on chemistry exams. First, leaving temperature in Celsius — this can throw results off by a factor of 10 or more. Second, mismatching the R value with the pressure unit. Third, using volume in mL or m³ when R expects liters; 500 mL is 0.5 L, not 500.
A quick sanity check: a mole of any gas at room temperature and 1 atm occupies about 24.5 liters. If your answer is wildly different from a multiple of that, recheck units before submitting.
One more subtle trap is the assumption that PV = nRT works for gas mixtures. It does, but only if you treat each gas separately using Dalton's law of partial pressures. The total pressure equals the sum of partial pressures, and each component obeys its own PV = nRT with the shared total volume and temperature.