Guide · Science
How to Use the Ideal Gas Law (PV = nRT)
Updated 2026-08-08 · 4 min read
The ideal gas law is
PV = nRT
P is pressure, V is volume, n is amount of gas in moles, T is temperature in kelvin, and R is the gas constant whose numerical value depends on the units of P and V.
The gas law calculator rearranges that equation in the browser. No account. It will convert among common pressure, volume, and temperature units, but you still have to know that 25 means 25 °C or 25 K before you pick the unit.
Pick R to match P and V
Two combinations cover almost every intro problem:
| P | V | R |
|---|---|---|
| atm | L | 0.082057 L·atm·mol⁻¹·K⁻¹ |
| Pa | m³ | 8.314 J·mol⁻¹·K⁻¹ |
Also common: R = 8.314 L·kPa·mol⁻¹·K⁻¹, because 1 J = 1 kPa·L. If P is in kPa and V is in L, 8.314 is the matching R.
Illegal: R = 0.0821 with P in kPa. Illegal: R = 8.314 with P in atm and V in L. The algebra looks fine; the number is not a mole count.
If a problem gives 101 kPa and 2.00 L, either convert 101 kPa to 0.997 atm and use 0.082057, or keep 101 kPa and 2.00 L with R = 8.314. Do not mix the two conversions halfway.
Kelvin is not a style choice
T_K = T_°C + 273.15 (273 is fine for most homework).
25 °C → 298 K
0 °C → 273 K
−10 °C → 263 K
Fahrenheit must go to Celsius first, then to kelvin. There is no “°F plus 273.”
At T = 0 K the model says P = 0 or V = 0, which is why you never leave a Celsius zero in the formula and conclude the gas vanished.
Find n for 2.00 L at 1.00 atm and 298 K
A flask holds 2.00 L of gas at 1.00 atm and 25 °C.
T = 298 K
R = 0.082057 L·atm·mol⁻¹·K⁻¹
n = PV / RT = (1.00)(2.00) / (0.082057 × 298)
= 2.00 / 24.453
= 0.0818 mol
At STP defined as 0 °C and 1 atm, one mole occupies 22.4 L, so 2.00 L would be 0.0893 mol. We are warmer than 0 °C, so fewer moles fit in 2.00 L at the same P - 0.0818 is smaller than 0.0893, which is the right direction. If you used T = 25 K, n would be about 1 mol, which is a red flag.
To recover P instead: P = nRT / V. Same numbers give 1.00 atm. That is the check after you rearrange.
When PV = nRT is the wrong model
High P, low T. Molecules are close; attractions and finite size matter. CO₂ near its condensation line is a textbook offender. Air in a bike tire at a few bar is still often treated as ideal for a first estimate; the same gas in a high-pressure cylinder may need a compressibility chart.
Mixtures. For ideal mixtures, P_total V = n_total RT, and each gas has a partial pressure P_i = x_i P_total. The calculator using n_total gives P_total, not a mole fraction.
Reactions that change n. If 2 H₂ + O₂ → 2 H₂O (gas), n changes. Use the law on a stated state (after reaction, after cooling), not on a frozen “same n” assumption unless the problem says no change in moles.
Vapor plus liquid. Equilibrium vapor pressure is a property of the liquid and T, not something you invent from n of an empty-headspace ideal gas unless you were given that n.
P from force. A piston with F and A gives P = F/A. That P can be the P in PV = nRT if it is the gas pressure (watch gauge vs absolute). See pressure from force and area.
Unit traps that look like bad chemistry
Using mL as if they were L: 2000 mL is 2.00 L, not 2000 L. n then comes out a thousand times too small or too large.
Using mmHg with R = 0.0821. Convert mmHg to atm (divide by 760) or use a matching R (62.36 L·mmHg·mol⁻¹·K⁻¹).
Solving for T and reporting 298 °C after you computed 298 K.
Density of the gas is m/V = (nM)/V = PM/RT. That uses molar mass M after you have the ideal-gas n or after you substitute. The gas-law page solves PV = nRT; it does not know the molar mass unless you bring it.
Rearrange, then convert pressure if needed
Leave one field for the gas law calculator to fill. Convert temperature to a kelvin-compatible unit first in your head even if the tool accepts °C. If the report wants psi or kPa after you solved in atm, use the pressure converter. For solution concentration after you know moles of a dissolved gas or solute, that is molarity, not a second gas law.
Frequently asked questions
What is the ideal gas law?
PV = nRT. Pressure times volume equals moles times the gas constant times absolute temperature. You solve for whichever variable is missing. The value of R must match the units of P and V.
Which R should I use?
If P is in atm and V is in liters, R = 0.082057 L·atm·mol⁻¹·K⁻¹. If P is in pascals and V is in m³, R = 8.314 J·mol⁻¹·K⁻¹ (same as Pa·m³·mol⁻¹·K⁻¹). Mixing 8.314 with liters and atmospheres will be wrong by orders of magnitude.
Why must temperature be in kelvin?
T in PV = nRT is absolute temperature. 25 °C is 298 K, not 25. Using Celsius (or Fahrenheit) makes n or P come out meaningless. 0 °C is 273 K, not zero moles.
When does the ideal gas law fail?
At high pressure, low temperature, or near condensation, when molecules occupy a non-negligible volume and attract each other. Then a van der Waals or measured compressibility factor is more honest. Room-temperature air at 1 atm is close to ideal for homework.
Is P in PV = nRT the same as P = F/A?
Same physical pressure, different knowns. Use F/A when you measured a force on a piston face. Use PV = nRT when you know moles, temperature, and volume (or any three of P, V, n, T). Convert units with the pressure converter if the two methods need to meet.
Does the gas law calculator require an account?
No. It runs in the browser. Leave one of P, V, n, T blank to solve for that variable, and keep R consistent with the units you chose.
Related guides
More reading that links back to the same tools and workflows.
How to Calculate Molarity of a Solution
Molarity formula, worked lab examples, and a local calculator for solution prep.
4 min read
How to Calculate Pressure From Force and Area
P = F/A with real examples. Calculate locally.
4 min read
Best Scientific Calculators for Chemistry and Physics
Molarity, pH, gas law, force, and energy calculators for lab and class. Run the math in your browser with worked examples.
5 min read
How to Calculate Acceleration (With Examples)
Use a = Δv / t with worked problems. Run the numbers locally in a browser calculator.
4 min read