The Ideal Gas Law, Solved Both Ways: Algebra and a Calculator
How PV = nRT works, how to solve for pressure, volume, moles, or temperature, which gas constant R to use, and when real gases stop obeying the equation.
The Ideal Gas Law, Solved Both Ways: Algebra and a Calculator
Four quantities describe a confined gas well enough for almost any homework problem and most lab work: pressure, volume, the amount of substance, and temperature. The ideal gas law ties them together in one short equation, and once you can rearrange it, you can find any one of the four from the other three. The catch is never the algebra. It is the units. This post walks through the equation, the rearrangements, the single gas constant you actually need, a worked example, and the conditions where the whole model quietly falls apart.
What PV = nRT actually says
The equation is:
PV = nRT
- P is pressure
- V is volume
- n is the amount of substance, in moles
- R is the universal gas constant
- T is the absolute temperature
Read it as a statement about a box of gas. The left side, pressure times volume, scales with the total kinetic energy the molecules carry. The right side scales with how many molecules there are (n) and how fast they move on average (T). Push the temperature up and either the pressure rises or the volume expands. Add more gas and the same thing happens. The constant R is just the conversion factor that makes the two sides balance in a chosen system of units.
The model behind it makes two assumptions: gas molecules are point particles with no size of their own, and they neither attract nor repel each other. Those are lies, but useful ones. At ordinary pressures and temperatures the molecules are so far apart and moving so fast that their size and their mutual pull barely register, and the equation lands within a few percent of reality.
Solving for any one variable
The reason the equation is worth memorizing is that it rearranges into four shapes, one for each unknown:
- Pressure: P = nRT / V
- Volume: V = nRT / P
- Amount: n = PV / RT
- Temperature: T = PV / nR
Each is the same equation with one symbol moved across the equals sign. The only traps are dividing by zero (an amount or temperature of zero is not a physical gas state) and forgetting that T must be absolute. If you would rather not move the symbols around by hand, the Ideal Gas Law Calculator lets you pick which variable is unknown, fill in the other three with whatever units your problem uses, and reads the answer straight off. It does the SI conversion internally so you never juggle two different gas constants.
The gas constant R, and why one value is enough
In SI base units, the universal gas constant is:
R = 8.314 J/(mol·K)
(more precisely, 8.314462618 J/mol·K, the exact CODATA value). This value is the right one only when pressure is in pascals, volume in cubic meters, amount in moles, and temperature in kelvin. Feed it liters and atmospheres and your answer will be off by orders of magnitude.
This is where most beginners get burned. Textbooks also list R = 0.08206 L·atm/(mol·K) for problems stated in liters and atmospheres, and 62.36 L·mmHg/(mol·K) for pressures in millimeters of mercury. Each is correct, but only with its matching unit set. Mixing them is the single most common way to wreck a gas-law calculation. The clean discipline is to convert everything to SI first — pascals, cubic meters, kelvin, moles — solve with the one R above, and convert the answer back to whatever unit the problem wants at the very end. If you are doing the conversions by hand, a unit converter keeps the pressure and volume swaps honest.
Temperature deserves its own warning. The equation needs an absolute scale, one that starts at true zero. Kelvin does; 0 K is absolute zero, where molecular motion stops. Celsius and Fahrenheit start at arbitrary points, so plugging 25 °C into the equation as "25" instead of 298.15 K injects a meaningless offset. Always convert: T(K) = T(°C) + 273.15.
A worked example: the molar volume at STP
Here is the result every chemistry student eventually memorizes, derived from scratch.
Take one mole of an ideal gas at standard conditions: temperature 273.15 K (0 °C) and pressure 101325 Pa (1 atm). Solve for volume:
V = nRT / P
V = (1 mol × 8.314462618 J/mol·K × 273.15 K) / 101325 Pa
V = 2271.1 / 101325 m³
V ≈ 0.022414 m³
V ≈ 22.4 L
One mole of any ideal gas occupies about 22.4 liters at 0 °C and 1 atm. That is the classic textbook molar volume. Note the units quietly canceling: joules divided by pascals leaves cubic meters, because a joule is a pascal times a cubic meter. The number 22.4 L is not a constant you have to trust on faith — it falls straight out of PV = nRT the moment you keep your units in SI.
(If your course uses the modern IUPAC definition of STP, 0 °C and 100 kPa, the molar volume shifts to 22.711 L. Same equation, slightly different pressure.)
When I trust it, and when I stop
I spent a stretch of undergrad lab work measuring gas volumes over water, and the ideal gas law was my default for every back-of-envelope check. Most of the time it was indistinguishable from the truth. Where I learned to be careful was a high-pressure nitrogen rig: at a couple hundred bar the equation started overestimating how much gas a cylinder held, and the discrepancy was not measurement noise — it was the model breaking. That was the day "ideal" stopped being an abstract word and became a condition I had to check before trusting a number.
When real gases stop obeying
The ideal gas law assumes molecules have no volume and no mutual attraction. Both assumptions fail in two regimes:
- High pressure. Squeeze the gas hard enough and the molecules' own volume becomes a real fraction of the container. The gas resists compression more than the equation predicts, so PV = nRT underestimates the pressure (or overestimates how much gas fits a given volume).
- Low temperature, near condensation. Cool a gas toward the point where it would liquefy and intermolecular attractions start pulling molecules together. The gas behaves as if it has slightly less pressure than the ideal value, because some of the molecular kinetic energy is spent fighting that attraction.
Both effects are small for everyday conditions — room temperature, a few atmospheres at most — which is why the law works so well for homework and ordinary lab work. When you push into extremes, chemists switch to a real-gas equation like van der Waals, which adds two correction terms: one for molecular volume, one for attraction. For estimating, sizing a storage cylinder, or checking a stoichiometry answer near room conditions, the ideal gas law is accurate to a few percent, and that is usually all you need.
So: memorize the four rearrangements, keep one gas constant and one unit system, always go to kelvin, and remember that "ideal" is a promise that only holds when molecules are far apart and moving fast. Inside that envelope, PV = nRT is one of the most reliable equations in all of chemistry.
Made by Toolora · Updated 2026-06-13