The ideal gas law, PV = nRT, ties together the four properties that describe any gas: pressure, volume, amount, and temperature. It is one of the most useful equations in chemistry and physics because, with three of those quantities known, the fourth follows immediately. This article explains where the law comes from, how to keep your units consistent, what the gas constant means, and when real gases stop behaving ideally.
Where PV = nRT comes from
The ideal gas law is a synthesis of three experimental gas laws discovered in the 17th and 18th centuries. Boyle's law found that pressure and volume are inversely proportional at fixed temperature (PV = constant). Charles's law showed volume is proportional to absolute temperature at fixed pressure (V/T = constant). Avogadro's law established that equal volumes of gas at the same temperature and pressure contain equal numbers of molecules (V ∝ n). Combining all three gives PV = nRT, where the single constant R captures the proportionality for every ideal gas. The law assumes gas particles have negligible volume and exert no forces on each other except during brief elastic collisions — assumptions that hold remarkably well for real gases at ordinary temperatures and pressures. It is the workhorse equation behind everything from scuba-diving tables to the chemistry of the atmosphere.
Keeping your units consistent
The single most common mistake with the gas law is mixing units, and the calculator above removes that risk by converting everything internally to SI (pascals, cubic metres, moles, kelvin). The non-negotiable rule is temperature must be absolute: always convert Celsius (K = °C + 273.15) or Fahrenheit (K = (°F − 32) × 5/9 + 273.15) to kelvin before substituting. Pressure and volume can be in any units as long as the value of R matches them — using R = 0.082057 L·atm/(mol·K) means pressure in atm and volume in litres, while R = 8.314 J/(mol·K) means pressure in pascals and volume in cubic metres. The calculator picks the right R for you, so you are free to enter pressure in psi and volume in millilitres and still get a correct answer; the conversions happen behind the scenes.
Working in grams instead of moles
Laboratory gases are usually weighed, not counted, so you often start with a mass rather than a number of moles. The bridge is the molar mass M: n = m / M, where m is the mass in grams and M is the molar mass in g/mol. For example, 32 g of oxygen gas (O₂, M = 32.00 g/mol) is exactly 1 mole, which occupies 22.4 L at STP. The amount input on the PV = nRT tab lets you toggle between moles and grams; choosing grams reveals a molar-mass field with one-click presets for common gases such as H₂ (2.02), N₂ (28.01), O₂ (32.00), CO₂ (44.01), and water vapour (18.02). This makes it easy to go straight from a balance reading to a pressure, volume, or temperature without a separate conversion step.
STP, NTP, and the molar volume
Because the gas law fixes a relationship between the four variables, picking a standard temperature and pressure pins down the molar volume — the space one mole occupies. Under the former STP (0 °C and 1 atm) that volume is the famous 22.414 L/mol. In 1982 IUPAC redefined standard pressure as 100 kPa (0.987 atm), giving a molar volume of 22.711 L/mol at 0 °C, so a textbook that says 22.4 L and one that says 22.7 L are both correct for their respective conventions. NTP (normal temperature and pressure, 25 °C and 1 atm) gives 24.465 L/mol. The STP tab in the calculator lets you switch between all three standards and instantly see how many litres a given amount of gas occupies, which is handy for quickly checking stoichiometry problems and gas-yield calculations.
When gases stop behaving ideally
No real gas is perfectly ideal. The model breaks down when molecules are forced close together — at high pressure, where their own volume is no longer negligible, and at low temperature, where weak attractions between molecules become significant and can eventually condense the gas into a liquid. The 150-atm cylinder example above is a case where the ideal answer is only an approximation. More accurate models such as the van der Waals equation add correction terms for molecular volume and intermolecular attraction, and engineers use a tabulated compressibility factor Z (where PV = ZnRT) for precise work with dense or near-condensation gases. For most everyday situations — air in a room, a balloon, a gas-law homework problem near room temperature and atmospheric pressure — the ideal gas law is accurate to within a percent or two, which is why it remains the first tool any chemist reaches for.