How the Ideal Gas Law Calculator Works
The ideal gas law, PV = nRT, ties together the four measurable properties of a gas sample: pressure (P), volume (V), the amount of gas in moles (n), and its absolute temperature (T). This calculator rearranges that single equation to solve for whichever one of the four you're missing, given the other three. It combines three older gas laws into one relationship: Boyle's law (pressure and volume are inversely related at constant temperature), Charles's law (volume grows with temperature at constant pressure), and Avogadro's law (volume grows with the amount of gas). Chemistry students use it to check lab results, HVAC and process engineers use it to size gas systems, and anyone curious about why a sealed bag of chips puffs up on a flight can use it to see the math behind that.
The part almost every other gas-law calculator gets sloppy about is the gas constant R. R is one physical constant, but its numerical value changes depending on which pressure and volume units you plug into the equation, and using the wrong R with the wrong units is the single most common reason two calculators disagree on the same problem. This tool fixes that by tying R directly to your chosen unit system and displaying the exact value it used on screen, every time. Behind the scenes it starts from the exact SI value, R = 8.31446261815324 J per mole per kelvin — this number is now defined exactly rather than measured, because the 2019 redefinition of the SI base units fixed both the Boltzmann constant and Avogadro's number, and R is simply their product. From that one exact number, the tool derives R = 0.082057366 L·atm/(mol·K) for the atm-and-liters chemistry convention, R = 62.363598 L·Torr/(mol·K) for millimetres of mercury, and R = 8.314462618 L·kPa/(mol·K) for kilopascals — each derivation shown step by step in the calculator's research notes so you can reproduce it yourself with a hand calculator.
To see the calculator in action, plug in the textbook example: 1 mole of an ideal gas at 273.15 K (0 °C) and 1 atmosphere of pressure. Solving V = nRT/P with R = 0.082057366 L·atm/(mol·K) gives V = 1 × 0.082057366 × 273.15 ÷ 1 = 22.414 litres — the classic "22.4 litres per mole" figure taught in every introductory chemistry course, and the exact molar volume this tool reports at STP. Temperature is always converted to kelvin internally regardless of whether you type °C or °F, because the equation is only valid for an absolute temperature scale; enter a value at or below absolute zero (−273.15 °C or −459.67 °F) and the calculator refuses to produce a number, since a negative absolute temperature is physically meaningless and would otherwise silently produce a negative, nonsensical volume.
Beyond the basic four-variable solve, this calculator adds three features aimed at real chemistry and physics work rather than a homework shortcut. First, a mass-to-moles converter that reuses the same chemical-formula parser as the Molar Mass Calculator, so typing "CO2" or "O2" instantly gives you both the molar mass and, from it, the sample's density (ρ = PM/RT) and the mass of your chosen amount of gas. Second, a combined gas law mode for P₁V₁/T₁ = P₂V₂/T₂, useful whenever a fixed amount of gas moves between two pressure-volume-temperature states, such as a weather balloon rising through the atmosphere or a scuba tank warming in the sun. Third, both competing definitions of STP — the traditional 0 °C/1 atm convention that gives 22.414 L/mol, and the IUPAC 1982-onward 0 °C/100 kPa convention that gives 22.711 L/mol — are shown side by side, because a mismatch between these two is a real and common source of "wrong answer" confusion.
It's worth being upfront about where the ideal gas law stops being accurate. Real gas molecules take up physical space and attract each other slightly, and PV = nRT ignores both effects. At everyday pressures and temperatures the error is small enough to ignore, but as pressure climbs past roughly 10 atmospheres, or temperature drops toward a gas's condensation point, the real behaviour diverges from the ideal prediction — this is what the van der Waals equation, (P + an²/V²)(V − nb) = nRT, corrects for with two gas-specific constants. This calculator always reports the ideal-gas answer, the right tool for most classroom and back-of-envelope engineering problems, but treat it as an approximation rather than a real-gas measurement near a gas's critical point. Every calculation runs entirely in your browser — nothing you type is uploaded anywhere.