Ideal gas law calculator
Enter three of P, V, n and T, get the fourth.
What is the ideal gas law?
PV = nRT: pressure × volume = moles × the gas constant × absolute temperature. R = 8.314 J/(mol·K), or 0.08206 L·atm/(mol·K).
What volume does one mole of gas take up?
At 0 °C and 1 atm, 22.414 liters — the classic molar volume from PV = nRT.
Why must temperature be in kelvin?
The law needs absolute temperature, which starts at absolute zero: K = °C + 273.15. The calculator converts °C and °F for you.
When is the ideal gas law accurate?
For most gases near room temperature and ordinary pressures. At high pressure or low temperature, real gases deviate.
Where does the gas constant come from?
R = Avogadro's number × the Boltzmann constant — both exact in the SI since 2019, so R = 8.31446261815324 J/(mol·K) exactly.
Which value of R do I use?
The one that matches your units. OpenStax Chemistry 2e (section 9.2) gives 0.08206 L·atm/(mol·K) for pressure in atm and volume in liters, and 8.314 kPa·L/(mol·K) for pressure in kPa. The calculator converts everything to SI internally, so you can enter pressure in atm, kPa, Pa, mmHg or psi and volume in liters, milliliters or cubic meters, and never have to choose.
What is STP, and what is the molar volume there?
OpenStax takes STP as 273.15 K and 1 atm (101.325 kPa), where one mole of an ideal gas occupies about 22.4 L. IUPAC has used 1 bar (100 kPa) as standard pressure since 1982, which gives 22.7 L. State which definition you use, because the two differ by about 1.3%.
How do I find the density or molar mass of a gas?
Rearrange to d = P × M ÷ (R × T), with M the molar mass. Nitrogen (28.014 g/mol) at 273.15 K and 1 atm has a density of 1.25 g/L, as in OpenStax Example 9.11. Going the other way, weigh a known volume of a gas at a known pressure and temperature, find the moles from PV = nRT, and divide the mass by the moles.
What the law assumes
PV = nRT combines Boyle’s, Amontons’s, Charles’s and Avogadro’s laws into one relation (OpenStax Chemistry 2e, section 9.2). It treats the gas as ideal: the molecules take up no volume and do not attract each other. Real gases follow it best at low pressure and moderate temperature. At high pressure or low temperature the answer drifts away from reality. The temperature must be absolute, in kelvin, and the pressure must be absolute too: a gauge reading is the pressure above the surrounding atmosphere, so add the atmospheric pressure first.
Worked examples
OpenStax Example 9.9 asks for the volume of 655 g of methane at 25 °C and 745 torr. The molar mass of CH₄ is 16.043 g/mol, so n = 655 ÷ 16.043 = 40.8 mol. With T = 25 + 273.15 = 298.15 K and P = 745 mmHg = 0.980 atm, V = nRT ÷ P = 1019 L, which the book rounds to 1.02 × 10³ L. Choose “Volume” in the calculator, enter 745 mmHg, 40.8 mol and 25 °C. The practice problem is a pressure: 2,520 mol of hydrogen in a 180 L tank at 27 °C gives 349 bar, about the 350 bar the book reports.
Common mistakes
The classic error is using Celsius for T. In the methane example, T = 25 instead of 298.15 would give 85 L, more than ten times too small. Second, mixing units with a fixed R: 0.08206 only works with atm and liters, so converting pressure but not volume gives nonsense; this calculator does the conversions, but a hand calculation needs to match them. Third, entering grams where the calculator wants moles: convert with the molar mass first. Fourth, applying the law at high pressure or low temperature, where a real gas does not follow PV = nRT closely.
Sources: OpenStax Chemistry 2e, section 9.2 “Relating Pressure, Volume, Amount, and Temperature: The Ideal Gas Law” (law, R, STP, Example 9.9) and section 9.3 (gas density, Example 9.11); molar volumes from the exact SI value of R (NIST CODATA). Related: combined gas law calculator, partial pressure calculator, Graham’s law calculator and grams to moles calculator.