
How to Use the Ideal Gas Law Calculator

- Choose the unknown: pressure, volume, amount or temperature.
- Enter the known values and pick each unit from its menu.
- Temperature can be in °C, °F or K. It is converted to kelvin for you.
- Optionally add a molar mass to work in grams and get the gas density.
- Read the answer, its value in other units and the molar volume.
Pick the quantity you want to find: pressure, volume, amount or temperature. Its box turns blue and fills in with the answer, while you type the other three in the units you have. Each box has its own unit menu, so you can mix atm with liters and degrees Celsius without converting anything by hand.
To work from a mass of gas, set the amount unit to grams and enter the molar mass, such as 32.00 g/mol for oxygen or 44.01 g/mol for carbon dioxide. With a molar mass entered, the results also show the mass and density of the gas. The STP and SATP buttons fill in the standard conditions.
All the working is done in SI units, so you can check the substitution in the note under the result. Change the unit menu of the answer box at any time to see the result in another unit without retyping anything.
The Ideal Gas Law
P = nRT ÷ V V = nRT ÷ P n = PV ÷ RT T = PV ÷ nR
R = 8.314462618 J/(mol·K) = 0.0820574 L·atm/(mol·K) = 8.314462618 L·kPa/(mol·K)
Density: ρ = PM ÷ RT
The temperature must be absolute, in kelvin, which the calculator handles for you: K = °C + 273.15. The gas constant is the product of the Avogadro and Boltzmann constants, both exact in the SI since 2019, so R is exact as well. The values used here match the NIST CODATA listing.
Gas Constant in Common Units
| Units of P and V | R |
|---|---|
| Pa and m³ (J) | 8.314462618 J/(mol·K) |
| kPa and L | 8.314462618 L·kPa/(mol·K) |
| atm and L | 0.0820573661 L·atm/(mol·K) |
| bar and L | 0.0831446262 L·bar/(mol·K) |
| mmHg and L | 62.3636 L·mmHg/(mol·K) |
Worked Examples
- Volume at STP: 1 mol at 0 °C (273.15 K) and 1 atm (101,325 Pa) occupies V = 1 × 8.314462618 × 273.15 ÷ 101,325 = 0.0224140 m³, or 22.414 L. This is the molar volume at STP.
- Pressure: 2 mol in a 10 L container at 25 °C (298.15 K) gives P = 2 × 8.314462618 × 298.15 ÷ 0.010 = 495,791 Pa, which is 495.79 kPa or 4.8931 atm.
- Moles: a 5 L flask at 200 kPa and 300 K holds n = 200,000 × 0.005 ÷ (8.314462618 × 300) = 0.400908 mol.
- Temperature: 1 mol in 24 L at 2 atm is at T = 202,650 × 0.024 ÷ 8.314462618 = 584.96 K, or 311.81 °C.
- From grams: 10 g of oxygen (32.00 g/mol) is 0.3125 mol and fills 7.0044 L at STP. Its density there is 1.4277 g/L.
Related Gas Laws
For a fixed amount of gas, nR is constant, so PV ÷ T stays the same between two states. This combined gas law, P₁V₁ ÷ T₁ = P₂V₂ ÷ T₂, contains Boyle’s law (constant T), Charles’s law (constant P) and Gay-Lussac’s law (constant V). For example, 2.0 L of gas at 1 atm and 20 °C squeezed to 0.5 L and heated to 50 °C reaches 1 × 2.0 ÷ 293.15 × 323.15 ÷ 0.5 = 4.41 atm. You can check this here: solve for n in the first state, then solve for P in the second.
STP, SATP and Molar Volume
Standard temperature and pressure has more than one definition. The older chemistry convention of 0 °C and 1 atm gives a molar volume of 22.414 L/mol. IUPAC now uses 0 °C and 1 bar, which gives 22.711 L/mol, and standard ambient conditions (SATP) of 25 °C and 1 bar give 24.790 L/mol. Check which one your course uses before comparing answers.
When the Ideal Gas Law Works
The law assumes molecules take up no space and do not attract each other. That is a good approximation for most gases near room temperature and atmospheric pressure, typically within a few percent. It becomes less accurate at high pressures, at low temperatures near condensation, and for strongly interacting gases such as ammonia or water vapor. For those cases, an equation of state such as van der Waals adds corrections for molecular size and attraction.
Frequently asked questions
What is the ideal gas law formula?
PV = nRT, where P is pressure, V is volume, n is the amount in moles, R is the gas constant and T is the absolute temperature in kelvin. Rearrange it to solve for whichever quantity is unknown.
What value of R should I use?
Use 8.314 J/(mol·K) with pascals and cubic meters or with kPa and liters, and 0.08206 L·atm/(mol·K) with atmospheres and liters. The calculator converts units for you, so any combination works.
Why must temperature be in kelvin?
The ideal gas law relates volume and pressure to absolute temperature, which starts at absolute zero. Celsius and Fahrenheit have arbitrary zero points, so convert to kelvin first: K = °C + 273.15.
What is the volume of one mole of gas at STP?
At 0 °C and 1 atm, one mole of an ideal gas occupies 22.414 liters. At the IUPAC standard of 0 °C and 1 bar it is 22.711 liters, and at 25 °C and 1 bar it is 24.790 liters.
How do I find moles of gas from grams?
Divide the mass by the molar mass: n = m ÷ M. Choose grams as the amount unit and enter the molar mass, and the calculator does this conversion before solving the gas law.
How do I calculate gas density?
Gas density is ρ = PM ÷ RT, where M is the molar mass. Enter a molar mass and the calculator shows the density in kg/m³, which is the same number as grams per liter.