HomeAll CategoriesIdeal Gas Law Calculator (PV = nRT) with Steps | Free

Ideal Gas Law Calculator (PV = nRT) with Steps | Free

Ideal Gas Law Calculator

Solve PV = nRT for pressure, volume, moles or temperature in any units, with every step, a units check and a van der Waals real-gas comparison. Use the combined gas law, find gas density and molar mass, and fit your own Boyle, Charles or Gay-Lussac lab data.

PhysicsChemistryPV = nRTGas LawsStep by StepAny UnitsFree

⚡ 0. Quick Answer

The ideal gas law, PV = nRT, links the pressure, volume, amount and kelvin temperature of a gas through R = 8.314 J/(mol·K). Worked example: 2.00 mol at 25.0 °C (298.15 K) in 10.0 L has P = 2.00 × 8.314 × 298.15 / 0.0100 m³ = 496 kPa (4.89 atm).

P V = n R T   ·   P [Pa], V [m³], n [mol], T [K], R = 8.314 462 618 J mol−1 K−1 = 0.082 057 L·atm mol−1 K−1

Rule of thumb: one mole of any ideal gas fills 22.4 L at 0 °C and 1 atm, and 24.5 L at 25 °C and 1 atm. Always use kelvin and absolute pressure, or the answer is wrong.

Key Takeaways

  • The ideal gas law is PV = nRT; 2.00 mol at 25.0 °C in 10.0 L exerts 496 kPa.
  • The gas constant is R = 8.314 462 618 J/(mol·K), exact since 2019, equal to 0.082 06 L·atm/(mol·K).
  • Temperature must be in kelvin: 25 °C is 298.15 K, and typing 25 K gives a pressure 12 times too small.
  • One mole of ideal gas fills 22.41 L at 0 °C and 1 atm (22.71 L at the IUPAC STP of 100 kPa).
  • Real gases depart from the law at high pressure: air in a 207 bar scuba tank is about 1.6 % below the ideal pressure.

📚 1. What Is the Ideal Gas Law?

The ideal gas law is the equation of state PV = nRT. It says that the pressure P times the volume V of a gas equals the number of moles n times the gas constant R times the absolute temperature T. It describes a gas whose molecules take up no space and do not attract each other, which is a very good model for most gases near room conditions.

One-line example: 1.00 mol of gas at 273.15 K and 101 325 Pa fills V = nRT/P = 1 × 8.314 × 273.15 / 101 325 = 0.0224 m³ = 22.4 L.

The law joins four older laws: Boyle's law (PV constant, 1662), Charles's law (V ∝ T), Gay-Lussac's law (P ∝ T) and Avogadro's law (V ∝ n). Émile Clapeyron combined them in 1834, and the kinetic theory of Clausius (1857) and Maxwell (1860) explained it from molecular motion. It is taught in AP Chemistry and AP Physics 2, high school chemistry, IGCSE and GCSE, A level, CBSE and ICSE Class 11, NEET and JEE, and every first-year college chemistry, physics and engineering course. Engineers, divers, pilots, HVAC technicians and lab chemists use it daily.

LawHeld constantEquationGraphUse it when
Ideal gas lawNothingPV = nRTAny pairYou know three of P, V, n, T
Combined gas lawnP₁V₁/T₁ = P₂V₂/T₂Two statesA fixed amount of gas changes state
Boyle's lawn, TP₁V₁ = P₂V₂P vs 1/V straightSqueezing a syringe slowly
Charles's lawn, PV₁/T₁ = V₂/T₂V vs T straightA balloon heated or cooled
Gay-Lussac's lawn, VP₁/T₁ = P₂/T₂P vs T straightA sealed can or tyre heated
Van der WaalsNothing(P + an²/V²)(V − nb) = nRTCurved isothermsHigh pressure or near condensation
Ideal gas law isotherms for 2.00 mol of gas00300660012900181,200241,50030Volume (L)Pressure (kPa)179 K298 K447 K496 kPa at 10.0 L
Boyle isotherms for 2.00 mol of gas: each curve is one temperature. The purple point is the worked example, 496 kPa in 10.0 L at 298.15 K. Higher temperature moves the curve up and to the right.

🧮 2. Enter Your Values

Samples fill the boxes only. Nothing is calculated until you press Calculate.

Solve for:

Scientific notation works: 1.0e-6 or 1.0×10^-6. Pressure must be absolute: add 101.325 kPa (14.7 psi) to a gauge reading. Temperatures in °C, °F or °R are converted to kelvin for you. The temperature box accepts a comma-separated list, for example 25, 50, 75, 100.

Each group is one run, flask or syringe. Group names are editable.
📁 Upload CSV or Excel, then click the columns to load as groups

Solve for:

same unit
same unit
same unit

Keep P the same in both states for Charles's law, V the same for Gay-Lussac's law, or T the same for Boyle's law. The tool names the law it used.

Find:

📊 3. Results and Step-by-Step Working

___
Enter your values and press Calculate to see the answer, its units and every step.

🧠 4. Understanding Your Answer, In Detail

4.1 What your number means

___

4.2 Is it a sensible size?

___

4.3 What the molecules are doing

___

4.4 How the answer scales

___

4.5 Real gas or ideal gas?

___

4.6 What the four graphs show

Chart 1 shows Boyle isotherms: at a fixed temperature, pressure falls as 1/V, so halving the volume doubles the pressure. Chart 2 is Gay-Lussac's law: at a fixed volume, pressure rises in a straight line with kelvin temperature and would reach zero at 0 K. Chart 3 is Charles's law, the same straight line for volume at fixed pressure. Chart 4 compares the ideal answer with the van der Waals pressure of eight real gases at your exact n, V and T, so you can see which gases would break the ideal model.

4.7 Why the law needs kelvin

Pressure comes from molecules hitting the walls, and their average kinetic energy is (3/2)kBT with T in kelvin. At 0 K the motion (and the ideal-gas pressure) would stop. Celsius and Fahrenheit have their zero in the wrong place, so ratios such as T₂/T₁ only make sense in kelvin. Students often miss this; it is one of the main difficulties found in physics education research on the gas law (Kautz et al., 2005a).

4.8 Where this leads next

Use the Combined Gas Law tab when the same gas changes from one state to another, the Density & Molar Mass tab to identify a gas from its density, and the Fit From Data tab to analyse your own Boyle, Charles or Gay-Lussac experiment and estimate absolute zero.

✍ 5. How to Write Your Results in Research and Exams

Each card fills in after you press Calculate. Copy the one that fits where the answer is going.

Exam answer (GRESS layout)
___
Conventions

Write Given, Required, Equation, Substitute and Solve on separate lines. Convert to kelvin and to SI units (Pa, m³) first, or use R = 0.08206 L·atm/(mol·K) with litres and atmospheres. Round only the final answer, to the smallest number of significant figures in the data.

Final answer only
___
Lab report or research methods sentence
___
Conventions

State the equation, the value of R and its source (CODATA 2022; Mohr et al., 2025), whether pressures are absolute, and the temperature in kelvin. For fitted data, give the slope with its standard error, R², the number of points and a 95 % confidence interval. For high-pressure or condensing gases, say which real-gas equation you compared with (van der Waals, Redlich-Kwong, Peng-Robinson) or cite a reference equation of state such as Lemmon et al. (2000) for air.

Teacher's answer-key line
___
Plain text for a forum or chat
___

5.1 A model results paragraph

"The pressure of air sealed in a 0.500 L flask rose linearly with temperature between 0 and 100 °C (R² = 0.999, n = 6). Least-squares extrapolation to zero pressure gave absolute zero at −273.8 °C (95 % CI −288.1 to −259.4 °C), consistent with the accepted value of −273.15 °C. The slope, 331.6 Pa/K, corresponds to 0.0199 mol of gas." Replace the numbers with your own from the Fit From Data tab.

∑ 6. Formulas Used

①
The Ideal Gas Law
P V = n R T
PAbsolute pressure, pascals (Pa = N/m²)
VVolume, cubic metres (m³); 1 L = 0.001 m³
nAmount of gas, moles (mol)
TAbsolute temperature, kelvin (K) = °C + 273.15
Example2.00 mol × 8.314 × 298.15 K / 0.0100 m³ = 4.96 × 105 Pa
②
Rearranged for Each Unknown
P = nRT/V  ·  V = nRT/P  ·  n = PV/(RT)  ·  T = PV/(nR)
RuleDivide both sides by everything except the unknown
Examplen = (253 313 Pa)(0.00500 m³) / (8.314 × 293.15 K) = 0.520 mol
③
The Gas Constant in Different Units
R = 8.314 462 618 J/(mol·K) = 0.082 057 37 L·atm/(mol·K) = 62.3636 L·Torr/(mol·K)
RAlso 8.314 L·kPa/(mol·K), 0.083 14 L·bar/(mol·K), 1.987 cal/(mol·K), 10.73 ft³·psi/(lb-mol·°R)
RulePick the R whose units match your P and V, or convert to SI
④
Combined, Boyle, Charles and Gay-Lussac Laws
P₁V₁/T₁ = P₂V₂/T₂  ·  P₁V₁ = P₂V₂  ·  V₁/T₁ = V₂/T₂  ·  P₁/T₁ = P₂/T₂
RequiresThe same amount of gas n in both states; T in kelvin
NoteP and V units cancel, so any unit works if both states match
⑤
Density and Molar Mass Forms
ρ = PM / (RT)  ·  M = ρRT / P = mRT / (PV)  ·  n = m / M
ρDensity, kg/m³ (equal to g/L)
MMolar mass, kg/mol in SI (g/mol ÷ 1000)
ExampleAir at 1 atm, 20 °C: ρ = 101 325 × 0.028 965 / (8.314 × 293.15) = 1.204 kg/m³
⑥
Real Gases and Kinetic Theory
(P + a n²/V²)(V − n b) = nRT  ·  Z = PV/(nRT)  ·  vrms = √(3RT/M)
a, bVan der Waals constants: attraction (L²·bar/mol²) and molecular volume (L/mol)
ZCompressibility factor; Z = 1 for an ideal gas
EkAverage kinetic energy per molecule = (3/2) kBT, in joules
⑦
Constants Used
R = NA kB = 8.314 462 618... J mol−1 K−1 (exact)
NA6.022 140 76 × 1023 mol−1 (exact)
kB1.380 649 × 10−23 J/K (exact)
1 atm101 325 Pa (exact); 0 °C = 273.15 K (exact)

🔀 7. Ideal Gas Law Calculation Flowchart, Step by Step

This flowchart shows how to solve the ideal gas law step by step, on the same worked problem used in Sections 0, 9, 10, 11 and 14: 2.00 mol of gas at 25.0 °C in a 10.0 L container. What is the pressure?

Start or result Data step Calculation step Yes or no check
Start2.00 mol, 25.0 °C, 10.0 L. Find Pn = 2.00 mol, T = 25.0 °C, V = 10.0 L
1
List the values with unitsn = 2.00 mol, T = 25.0 °C, V = 10.0 L, P = ?
CheckIs the temperature in kelvin?
NoAdd 273.15: 25.0 + 273.15 = 298.15 K.
YesCarry on with the value as it is.
2
Convert to SI unitsT = 298.15 K, V = 10.0 L × 0.001 = 0.0100 m³
3
Rearrange for PP = nRT / VDivide both sides of PV = nRT by V
4
Multiply n, R and TnRT2.00 × 8.314 462 618 × 298.15 = 4957.91 J
5
Divide by the volumeP = nRT / V4957.91 J ÷ 0.0100 m³ = 495 791 Pa
CheckIs the size sensible? (2 mol would fill about 49 L at 1 atm)
YesSqueezed into 10 L, about 5 times smaller, so about 5 atm. 4.89 atm fits.
NoRecheck kelvin and litres-to-m³.
6
Convert to the units you need495 791 Pa = 496 kPa = 4.89 atm = 71.9 psi
ResultP = 496 kPa (3 significant figures)Units check ✓ VerifiedPa × m³ = J, so nRT/V gives Pa.

Check any box yourself: the Excel sheet in Section 9, the R script in Section 10, the Python script in Section 11 and the hand method in Section 14 all give 496 kPa for this problem.

📝 8. How to Use This Calculator

  1. Choose a tab. Pick PV = nRT Solver for one state, Fit From Data for lab readings, Combined Gas Law for two states, or Density and Molar Mass.
  2. Choose what to solve for. Tick Pressure, Volume, Moles or Temperature. That box turns into a dashed question mark.
  3. Type the three known values. Enter plain numbers such as 2.00, 101.3 or 1.0e-6. Put units in the drop-down menus, not in the boxes.
  4. Pick the units. Use any pressure (Pa, kPa, atm, bar, psi, mmHg, torr), volume (L, mL, m³, ft³, gal), amount (mol or a mass) and temperature (K, °C, °F, °R). The tool converts them.
  5. Enter absolute pressure. Add atmospheric pressure (101.325 kPa or 14.7 psi) to a gauge reading before you type it.
  6. Pick a gas if you know it. The gas menu fills the molar mass, so you can enter grams instead of moles, and turns on the van der Waals real-gas check.
  7. Add a list of temperatures if needed. Type several temperatures separated by commas, such as 25, 50, 75, to get a table of answers.
  8. Press Calculate. Nothing is calculated until you press Calculate or Enter. The answer appears with its units, a units check and a verification badge.
  9. Read the steps and the graphs. Follow the GRESS working and the numbered steps, then check the four graphs and the live picture of the gas.
  10. Copy or download the working. Copy a ready-made exam, report or forum answer from Section 5, or press Download Doc or Download PDF.

📈 9. How to Calculate the Ideal Gas Law in Excel

Excel has no built-in gas law function, but PV = nRT fits in one cell. This section solves the worked problem (2.00 mol, 25.0 °C, 10.0 L), rearranges it for V, n and T, converts units with CONVERT, and fits Gay-Lussac lab data to estimate absolute zero.

The whole thing in one cell: with n (mol) in B2, T (°C) in C2 and V (L) in D2, type =B2*8.314462618*(C2+273.15)/(D2/1000). It returns 495 791 Pa. For atmospheres use =B2*0.082057366*(C2+273.15)/D2, which returns 4.893 atm.

9.1 The formulas you need

You wantExcel formulaUnits used
Pressure P=n*R*T/V → =B2*8.314462618*(C2+273.15)/(D2/1000)mol, °C, L → Pa
Volume V=B3*0.082057366*(C3+273.15)/E3mol, °C, atm → L
Moles n=E4*D4/(0.082057366*(C4+273.15))atm, L, °C → mol
Temperature T=E5*D5/(B5*0.082057366)-273.15atm, L, mol → °C
Density ρ=P*M/(8.314462618*T)/1000Pa, g/mol, K → g/L
Unit conversion=CONVERT(32,"psi","Pa"), =CONVERT(25,"C","K")Case sensitive unit strings
Absolute zero from data=-INTERCEPT(B2:B7,A2:A7)/SLOPE(B2:B7,A2:A7)P in B, T (°C) in A
Slope, intercept and their SEs=LINEST(B2:B7,A2:A7,TRUE,TRUE)Row 2 holds the standard errors

9.2 Step by step

1 One row per problem, units in the headers

Use headers such as "n (mol)", "T (C)", "V (L)" and keep R in its own cell, for example H1, so you can use $H$1 in every formula.

Excel sheet: 2XBook1 - Excelfx2ABCD1Problemn (mol)T (C)V (L)2Worked2.0025.010.03Tank0.52020.05.004STP1.0000.022.41

Row 2 is the worked problem: 2.00 mol, 25.0 °C, 10.0 L.

2 Convert the temperature and the volume

=C2+273.15=D2/1000
Excel sheet: =C2+273.15XBook1 - Excelfx=C2+273.15ABCDEF1Problemn (mol)T (C)V (L)T (K)V (m3)2Worked2.0025.010.0298.150.013Tank0.52020.05.00293.150.0054STP1.0000.022.41273.150.02241

E2 = 298.15 K and F2 = 0.01 m³.

3 Apply PV = nRT and convert the answer

=B2*$H$1*E2/F2=G2/101325
Excel sheet: =B2*$H$1*E2/F2XBook1 - Excelfx=B2*$H$1*E2/F2ABCDE1ProblemT (K)V (m3)P (Pa)P (atm)2Worked298.150.014957914.8933Tank293.150.0052533132.5004STP273.150.022411013361.000

G2 shows 495 791 Pa; dividing by 101 325 gives 4.893 atm.

4 Estimate absolute zero from lab data

Put temperatures (°C) in A and pressures in B. The x-intercept of the straight line is absolute zero.

=SLOPE(B2:B7,A2:A7)=-INTERCEPT(B2:B7,A2:A7)/SLOPE(B2:B7,A2:A7)
Excel sheet: =-INTERCEPT(B2:B7,A2:A7)/SLOPE(B2:B7,A2:A7)XBook1 - Excelfx=-INTERCEPT(B2:B7,A2:A7)/SLOPE(B2:B7,A2:A7)ABCD1T (C)P (kPa)SlopeAbs. zero (C)2090.40.33157-273.7632097.6440104.6560110.66......

For Flask A the slope is 0.33157 kPa/°C and absolute zero comes out at −273.76 °C, the same as the Fit From Data tab.

9.3 The awkward cases

  • Celsius in the formula. =B2*0.08206*C2/D2 with C2 = 25 gives 0.41 atm instead of 4.89 atm. Always add 273.15.
  • Litres with the SI value of R. 8.314 needs m³; with litres the answer is 1000 times too big. Use 0.082057366 for L·atm or divide L by 1000.
  • Gauge pressure. A tyre gauge reads above atmospheric. Add 101.325 kPa or 14.696 psi before using the law.
  • CONVERT strings. "atm", "mmHg", "Torr", "psi", "Pa", "bar", "C", "F", "K" and "l" are case sensitive; a wrong one returns #N/A.

9.4 Why Excel might disagree with R or Python

SituationWhat happensFix
R typed as 8.314 or 0.0821Answers change in the 4th significant figure (0.0821 gives 4.896 atm instead of 4.893 atm)Use 8.314462618 or 0.082057366
273 instead of 273.15About 0.05 % lower at room temperatureUse 273.15
STP definition0 °C and 1 atm gives 22.414 L/mol; IUPAC 0 °C and 100 kPa gives 22.711 L/molSay which STP you use
SciPy's Rscipy.constants.R is 8.314462618, the same exact valueNo fix needed

9.5 Charting it

  1. Select temperature and pressure, then Insert → Scatter (not Line).
  2. Add a Linear trendline with Display Equation, and in Format Trendline set Backward forecast to 300 so the line reaches the x axis near −273 °C.
  3. For Boyle's law, plot P against =1/V and add a linear trendline; the slope is nRT.
  4. Label the axes with units: "Temperature (°C)" and "Pressure (kPa)".

9.6 Errors you will hit

Excel showsWhyFix
#DIV/0!V, P, n or T is 0 or blankFill every input cell
#VALUE!Text such as "10 L" in a number cellPut units in the header only
#N/AWrong unit string in CONVERTCheck the case: "atm", not "ATM"
Negative TKelvin result below zero after subtracting 273.15 means bad inputsCheck units of P and V

📈 10. How to Calculate the Ideal Gas Law in R

Copy the whole block into RStudio, Posit Cloud or a file run with Rscript gaslaw.R. Base R only. Change the values at the top for your own problem.

10.1 The complete script

R, base only, saves gaslaw_plot.png at 300 dpi

# Ideal gas law calculator in R (StatsUnlock)
R_gas <- 8.314462618        # J/(mol K), CODATA 2022, exact
atm   <- 101325             # Pa, exact

# ---- Part A: solve PV = nRT for P ----
n   <- 2.00                  # mol
T_C <- 25.0                  # degrees Celsius
V_L <- 10.0                  # litres

T <- T_C + 273.15             # kelvin
V <- V_L / 1000               # m^3
P <- n * R_gas * T / V          # Pa
cat(sprintf("P = %.0f Pa = %.1f kPa = %.3f atm = %.1f psi\n", P, P / 1000, P / atm, P / 6894.757293168))
stopifnot(abs(P * V - n * R_gas * T) < 1e-9)    # substitute back

# other rearrangements
V_stp <- 1 * R_gas * 273.15 / atm * 1000        # molar volume, L
n_tank <- (2.50 * atm) * 0.00500 / (R_gas * 293.15)
cat(sprintf("molar volume at 0 C, 1 atm = %.3f L; n in tank = %.4f mol\n", V_stp, n_tank))

# van der Waals check for nitrogen (a in L^2 bar/mol^2, b in L/mol)
a <- 1.370; b <- 0.0387
P_vdw <- (n * 0.08314462618 * T / (V_L - n * b) - a * n^2 / V_L^2) * 1e5
cat(sprintf("van der Waals (N2) = %.1f kPa, %.2f %% from ideal\n", P_vdw / 1000, 100 * (P_vdw - P) / P))

# ---- Part B: absolute zero from Gay-Lussac data ----
temp_C <- c(0, 20, 40, 60, 80, 100)
P_kPa  <- c(90.4, 97.6, 104.6, 110.6, 116.8, 124.1)
fit <- lm(P_kPa ~ temp_C)
T0  <- -coef(fit)[[1]] / coef(fit)[[2]]
n_flask <- coef(fit)[[2]] * 1000 * 0.000500 / R_gas        # slope in Pa/K times V / R
cat(sprintf("absolute zero = %.2f C, n = %.5f mol, R^2 = %.5f\n", T0, n_flask, summary(fit)$r.squared))

# ---- Figure: isotherms ----
png("gaslaw_plot.png", width = 2000, height = 1400, res = 300)
v <- seq(2, 30, length.out = 200)           # L
plot(v, n * R_gas * T / (v / 1000) / 1000, type = "l", lwd = 2.5, col = "#2563eb",
     xlab = "Volume (L)", ylab = "Pressure (kPa)", main = "Ideal gas isotherm, 2.00 mol at 298.15 K")
points(V_L, P / 1000, pch = 8, cex = 2, col = "#9333ea")
dev.off()

Printed output: P = 495791 Pa = 495.8 kPa = 4.893 atm = 71.9 psi, molar volume at 0 C, 1 atm = 22.414 L; n in tank = 0.5196 mol, van der Waals (N2) = 494.2 kPa, -0.33 % from ideal, absolute zero = -273.76 C, n = 0.01994 mol, R^2 = 0.99899.

10.2 What each part does

LineWhat it does
T_C + 273.15Converts Celsius to kelvin. Forgetting this is the most common gas law mistake.
V_L / 1000Converts litres to cubic metres so the SI value of R works.
n * R_gas * T / VThe ideal gas law solved for P, in pascals.
stopifnot(...)Substitutes back into PV = nRT, the same check as the Verified badge.
lm(P_kPa ~ temp_C)Straight-line fit; minus intercept over slope is the temperature where P would be zero.

R traps: R is not a reserved word, but naming the gas constant R_gas avoids confusion with the language name; ^ is the power operator; round() rounds half to even.

10.3 What the figure shows

A Boyle isotherm for 2.00 mol at 298.15 K from 2 to 30 L, with a purple star at 10.0 L and 496 kPa.

10.4 Common problems and fixes

  • Pressure 1000 times too big: litres were used with 8.314; divide by 1000 or use 0.08206 L·atm/(mol·K).
  • Absolute zero far from −273 °C: a leak, a thermometer offset, or gas not at the bath temperature.
  • Figure not found: it is saved in getwd().

10.5 Useful one-liners

n * 0.082057366 * (T_C + 273.15) / V_L     # P in atm from mol, C, L
P_atm * V_L / (0.082057366 * (T_C + 273.15))  # n in mol
P_Pa * M / (8.314462618 * T_K) / 1000       # density in g/L, M in g/mol
P1 * V1 * T2 / (T1 * P2)                         # combined gas law, V2

📈 11. How to Calculate the Ideal Gas Law in Python

Install once: pip install numpy scipy matplotlib. Run in a terminal (python gaslaw.py), Jupyter or Google Colab.
scipy.constantsR, atm and zero_Celsius, exact CODATA values
scipy.statslinregress for lab data
numpyArrays of volumes and temperatures
matplotlibThe 300 dpi isotherm plot

11.1 The complete script

Python 3 with NumPy, SciPy and Matplotlib, saves gaslaw_plot.png

# Ideal gas law calculator in Python (StatsUnlock)
import numpy as np
from scipy import stats
from scipy.constants import R, atm, zero_Celsius, psi
import matplotlib.pyplot as plt

# ---- Part A: solve PV = nRT for P ----
n = 2.00                   # mol
T = 25.0 + zero_Celsius     # 298.15 K
V = 10.0 / 1000             # 10.0 L in m^3
P = n * R * T / V
print(f"P = {P:.0f} Pa = {P/1000:.1f} kPa = {P/atm:.3f} atm = {P/psi:.1f} psi")
assert abs(P * V - n * R * T) < 1e-9     # substitute back

# molar volume and molecular speed of nitrogen
Vm = R * zero_Celsius / atm * 1000
v_rms = np.sqrt(3 * R * T / 0.028014)        # M in kg/mol
print(f"molar volume at 0 C, 1 atm = {Vm:.3f} L; v_rms(N2) = {v_rms:.0f} m/s")

# van der Waals check for nitrogen
a, b = 1.370, 0.0387                # L^2 bar/mol^2, L/mol
VL = V * 1000
P_vdw = (n * (R / 100) * T / (VL - n * b) - a * n**2 / VL**2) * 1e5
print(f"van der Waals (N2) = {P_vdw/1000:.1f} kPa, {100*(P_vdw-P)/P:.2f} % from ideal")

# ---- Part B: absolute zero from Gay-Lussac data ----
temp_C = np.array([0, 20, 40, 60, 80, 100])
P_kPa = np.array([90.4, 97.6, 104.6, 110.6, 116.8, 124.1])
fit = stats.linregress(temp_C, P_kPa)
T0 = -fit.intercept / fit.slope
n_flask = fit.slope * 1000 * 0.000500 / R
print(f"absolute zero = {T0:.2f} C, n = {n_flask:.5f} mol, R^2 = {fit.rvalue**2:.5f}")

# ---- Figure ----
v = np.linspace(2, 30, 200)
fig, ax = plt.subplots(figsize=(7, 4.5))
for Tk, c in [(0.6 * T, "#0d9488"), (T, "#2563eb"), (1.5 * T, "#ea580c")]:
    ax.plot(v, n * R * Tk / (v / 1000) / 1000, color=c, lw=2, label=f"T = {Tk:.0f} K")
ax.plot(10.0, P / 1000, "*", ms=16, color="#9333ea", label="worked problem")
ax.set_xlabel("Volume (L)"); ax.set_ylabel("Pressure (kPa)"); ax.legend()
fig.savefig("gaslaw_plot.png", dpi=300, bbox_inches="tight")

Printed output: P = 495791 Pa = 495.8 kPa = 4.893 atm = 71.9 psi, molar volume at 0 C, 1 atm = 22.414 L; v_rms(N2) = 515 m/s, van der Waals (N2) = 494.2 kPa, -0.33 % from ideal, absolute zero = -273.76 C, n = 0.01994 mol, R^2 = 0.99899.

11.2 What each part does

LineWhat it does
from scipy.constants import RR = 8.314462618 J/(mol·K), exact; atm = 101325 Pa; zero_Celsius = 273.15 K; psi = 6894.757 Pa.
P = n * R * T / VThe ideal gas law in SI units, giving pascals.
R / 100Converts R to L·bar/(mol·K) to match the van der Waals constants.
stats.linregressStraight-line fit of pressure on temperature; the x-intercept is absolute zero.

Python traps: use ** for powers (^ is XOR); importing R and then writing R = ... for something else overwrites the gas constant; floats keep about 15 to 16 digits.

11.3 What the figure shows

Three isotherms (179, 298 and 447 K) for 2.00 mol of gas, with the worked problem marked by a star at 10.0 L and 496 kPa.

11.4 Common problems and fixes

  • Answer 1000 times too big: V left in litres; divide by 1000.
  • Answer about 12 times too small: T left in °C; add zero_Celsius.
  • ImportError for psi: update SciPy, or use 6894.757293168.

11.5 Useful one-liners

n * R * T / V                       # P (Pa)
n * R * T / P                       # V (m^3)
P * V / (R * T)                     # n (mol)
P * M / (R * T)                     # density (kg/m^3), M in kg/mol

📋 12. Reference Tables

12.1 Values of the gas constant R

Value of RUnitsUse with
8.314 462 618J mol−1 K−1 = Pa·m³ mol−1 K−1SI: Pa and m³
8.314 462 618L·kPa mol−1 K−1kPa and litres
0.082 057 366L·atm mol−1 K−1atm and litres (most chemistry classes)
0.083 144 626L·bar mol−1 K−1bar and litres
62.363 6L·Torr mol−1 K−1 (= L·mmHg to 5 s.f.)Torr or mmHg and litres
1.987 2cal mol−1 K−1Thermochemistry in calories
10.731 6ft³·psi lb-mol−1 °R−1US engineering units
1545.35ft·lbf lb-mol−1 °R−1US engineering energy units

Source: CODATA 2022 (Mohr et al., 2025). R = NAkB is exact since the 2019 SI; before that it was measured, for example with an acoustic resonator (Moldover et al., 1988).

12.2 Standard conditions and molar volume

NameTemperaturePressureMolar volume of ideal gas
STP (older chemistry texts)0 °C (273.15 K)1 atm (101.325 kPa)22.414 L/mol
STP (IUPAC since 1982)0 °C (273.15 K)1 bar (100 kPa)22.711 L/mol
SATP25 °C (298.15 K)1 bar24.790 L/mol
Room conditions, 1 atm25 °C1 atm24.465 L/mol
US gas industry standard60 °F (15.56 °C)14.696 psi23.690 L/mol (379.5 ft³/lb-mol)

12.3 Common gases: molar mass, density and van der Waals constants

GasM (g/mol)Density at 0 °C, 1 atm (g/L, ideal)a (L²·bar/mol²)b (L/mol)
Hydrogen (H₂)2.0160.08990.24760.02661
Helium (He)4.00260.17860.03460.0238
Methane (CH₄)16.0430.71582.2830.04278
Ammonia (NH₃)17.0310.75984.2250.0371
Water vapour (H₂O)18.0150.80375.5360.03049
Neon (Ne)20.180.90030.2080.01672
Nitrogen (N₂)28.0141.24981.370.0387
Dry air28.9651.29231.37250.0372
Oxygen (O₂)31.9981.42761.3820.03186
Argon (Ar)39.9481.78231.3550.032
Carbon dioxide (CO₂)44.0091.96353.640.04267
Propane (C₃H₈)44.0971.96748.7790.08445

Van der Waals constants are typical handbook values (CRC Handbook of Chemistry and Physics); molar masses from standard atomic weights. Accurate real-gas properties come from reference equations of state such as Lemmon et al. (2000) for air, Span and Wagner (1996) for CO₂, Setzmann and Wagner (1991) for methane and Wagner and Pruß (2002) for water.

12.4 Pressure conversions

UnitPakPaatmpsi
1 atm101 325 (exact)101.325114.696
1 bar100 000 (exact)1000.986 9214.504
1 psi6894.766.894 760.068 0461
1 mmHg ≈ 1 Torr133.3220.133 3221/7600.019 337
1 inHg3386.393.386 390.033 4210.491 15

12.5 Volume and temperature conversions

FromToRule
1 L = 1 dm³m³× 0.001
1 mL = 1 cm³m³× 10−6
1 ft³L× 28.3168
1 US gallonL× 3.785 41
°CKK = °C + 273.15
°FKK = (°F − 32) × 5/9 + 273.15
°R (Rankine)KK = °R × 5/9

📈 13. Example Results

Eight worked examples, from a textbook question to the traps that cost marks. Each figure is drawn to scale from the numbers in the card.

1
TEXTBOOK

Pressure of oxygen in a flask

The classic "find P" question.

0.500 mol of oxygen is held at 300 K in a 12.0 L flask. What is the pressure?

n = 0.500 molT = 300 KV = 12.0 L
StepValue
P = nRT/V0.500 × 8.314 × 300 / 0.0120
P1.04 × 10⁵ Pa = 104 kPa (1.03 atm)
Isotherm for 0.500 mol at 300 K0064812816192242563232040Volume (L)Pressure (kPa)300 K104 kPa
The point sits on the 300 K isotherm at 12.0 L.

What it means: Just above normal air pressure (101.3 kPa).

How to write it: P = nRT/V = 104 kPa

2
EXAM: FIND T

Find the temperature of a gas

Solving for T and converting to °C.

3.00 mol of gas fills 50.0 L at 150 kPa. What is its temperature?

n = 3.00 molV = 50.0 LP = 150 kPa
StepValue
T = PV/(nR)150 000 × 0.0500 / (3.00 × 8.314)
T301 K = 27.5 °C
Pressure against temperature at constant volume005090100180150270200360250450Temperature (K)Pressure (kPa)V = 50 L301 K
At constant volume P rises in a straight line with kelvin temperature.

What it means: A warm room, so the numbers are sensible.

How to write it: T = PV/(nR) = 301 K (27.5 °C)

3
US UNITS

Air in a car tyre

psi, cubic feet and Fahrenheit, plus gauge pressure.

A tyre gauge reads 32.0 psi on a 70 °F day. The tyre holds 0.40 ft³ of air. How much air is inside?

P = 32.0 + 14.7 = 46.7 psiaV = 0.40 ft³T = 70 °F = 294.26 K
StepValue
n1.49 mol
Mass (M = 28.97 g/mol)43 g of air
Tyre pressure against temperature302003623042260482905432060350Temperature (K)Absolute pressure (psi)46.7 psia
The tyre gains about 0.16 psi for each kelvin of warming.

What it means: Using the gauge reading of 32 psi would underestimate the air by 31 %.

How to write it: n = PV/(RT) = 1.49 mol (43 g of air)

4
EVERYDAY

Helium in a party balloon

How much helium, and how much can it lift?

A 15.0 L party balloon is filled with helium at 1.00 atm and 22 °C. How many moles and grams of helium does it hold?

V = 15.0 LP = 1.00 atmT = 295.15 K
StepValue
n0.619 mol
Helium mass2.48 g
Same volume of air17.9 g, so lift about 15 g
Moles of helium against balloon volume000.2860.56120.84181.1241.430Balloon volume (L)Moles of helium (mol)n ∝ V0.619 mol
At fixed P and T the moles are proportional to the volume (Avogadro).

What it means: The balloon lifts about 15 g minus its own rubber.

How to write it: n = PV/(RT) = 0.619 mol = 2.48 g He

5
EXTREME MAGNITUDE

Molecules left in ultra-high vacuum

A tiny pressure, still a huge number.

An ultra-high vacuum chamber is at 1.0 × 10⁻⁹ torr and 20 °C. How many gas molecules are in 1.0 cm³?

P = 1.0 × 10⁻⁹ torr = 1.33 × 10⁻⁷ PaV = 1.0 × 10⁻⁶ m³T = 293.15 K
StepValue
N = PV/(k_B T)3.3 × 10⁷ molecules
At 1 atm2.5 × 10¹⁹ molecules
Molecules per cubic centimetre against pressure4-127.2-910-614-3170203log₁₀ pressure (torr)log₁₀ molecules per cm³3.3 × 10⁷
Each factor of 10 in pressure changes the count by a factor of 10.

What it means: Even the best vacuum still holds millions of molecules per cm³.

How to write it: N = PV/(k_B T) = 3.3 × 10⁷ molecules

6
NOT PHYSICAL

Cooling below absolute zero

Where the ideal gas law gives no answer.

A student asks for the volume of 1.00 mol of gas at 1 atm and −300 °C.

T = −300 °C = −26.85 K
StepValue
T in kelvinnegative
Vnot physical
Charles line ends at 0 K0078014160212402832035400Temperature (K)Volume (L)V = nRT/P
The straight line reaches zero volume at 0 K. Nothing lies to its left.

What it means: The calculator shows a fuchsia Not physical badge. Real gases liquefy long before 0 K.

How to write it: No answer: −300 °C is below absolute zero.

7
MODEL LIMIT

Carbon dioxide at high pressure

When the ideal law is 20 % wrong.

1.00 mol of CO₂ is squeezed into 0.500 L at 300 K. Compare the ideal and van der Waals pressures.

n = 1.00 molV = 0.500 LT = 300 K
StepValue
Ideal P49.9 bar
Van der Waals P40.0 bar (−20 %)
Ideal and van der Waals isotherms for CO2 at 300 K00.10360.28720.461080.641440.821801Volume (L)Pressure (bar)idealvan der Waals40.0 bar real
Blue = ideal; dashed orange = van der Waals for CO₂. They split as the volume shrinks.

What it means: Attractions between CO₂ molecules lower the pressure; use a real-gas equation here.

How to write it: P(ideal) = 49.9 bar; P(vdW) = 40.0 bar

8
TRAP

Litres with R = 8.314

The 1000-times error.

A student finds the pressure of 1.00 mol at 273.15 K in 22.4 L using R = 8.314 and V = 22.4.

n = 1.00 molT = 273.15 KV = 22.4 L = 0.0224 m³
StepValue
Wrong (V in L)101 "Pa"
Right (V in m³)101 400 Pa = 1.00 atm
Isotherm at 273 K: the correct pressure at 22.4 L00921218424276363684846060Volume (L)Pressure (kPa)273 K101 kPa, not 101 Pa
The correct point is 101 kPa; 101 Pa would sit on the axis.

What it means: With R = 8.314, volume must be in m³; with litres use 0.08206 L·atm/(mol·K).

How to write it: P = 101 kPa (1.00 atm)

✏️ 14. How to Solve Ideal Gas Law Problems by Hand, Step by Step

This is the written method examiners expect, on the same problem as Sections 7, 9, 10 and 11: 2.00 mol of gas at 25.0 °C in a 10.0 L container. Find the pressure.

14.1 The written method (GRESS)

  1. Given. n = 2.00 mol, T = 25.0 °C, V = 10.0 L.
  2. Required. P, in kPa.
  3. Equation. PV = nRT, so P = nRT / V.
  4. Convert. T = 25.0 + 273.15 = 298.15 K; V = 10.0 L = 0.0100 m³.
  5. Substitute, with units. P = (2.00 mol)(8.314 J mol−1 K−1)(298.15 K) / (0.0100 m³).
  6. Solve. P = 4957.9 J / 0.0100 m³ = 495 791 Pa.
  7. Check the size. 2 mol at 25 °C fills about 49 L at 1 atm; squeezed into 10 L the pressure is about 4.9 times higher. 4.89 atm fits.
  8. Write the answer. P = 496 kPa (3 significant figures) = 4.89 atm.

Shortcut with L·atm: P = (2.00)(0.08206)(298.15) / 10.0 = 4.89 atm, with no volume conversion needed.

14.2 On a scientific calculator

TaskKeysDisplay
Pressure in Pa2 × 8.314462618 × ( 25 + 273.15 ) ÷ 0.01 =495791.4059
Pressure in atm2 × 0.082057366 × 298.15 ÷ 10 =4.893080739
Moles in a tank2.5 × 5 ÷ ( 0.082057366 × 293.15 ) =0.5196399614
Temperature3 × 2 ÷ ( 0.25 × 0.082057366 ) =292.478313

Put brackets around the whole denominator. Some calculators (for example the Casio fx-991EX) store R in a constants menu; the menu number differs between models, so check the manual, or just type 8.314462618.

14.3 Measure it yourself: a school lab practical

Finding absolute zero with a sealed flask (Gay-Lussac's law)

  1. Connect a sealed flask of air (for example 0.500 L) to a pressure sensor with short, stiff tubing.
  2. Put the flask in an ice-water bath (0 °C) and wait until the pressure reading is steady. Record the temperature and the pressure.
  3. Warm the bath in steps of about 20 °C up to boiling, stirring and waiting for steady readings each time.
  4. Enter the temperatures (°C) and pressures (kPa) in the Fit From Data tab with the experiment set to Gay-Lussac and the volume set to 0.500 L.
  5. Repeat with a second flask as a second group and compare.
T (°C)P, Flask A (kPa)P, Flask B (kPa)
090.4100.1
2097.6107.7
40104.6114.0

Graph to plot: pressure against temperature in °C. Extend the line to zero pressure: the x-intercept is absolute zero. Flask A gives −273.8 °C (95 % CI −288.1 to −259.4 °C) and Flask B gives −272.8 °C, both close to −273.15 °C. The slope divided by R and multiplied by V gives the moles of air, 0.0199 mol for Flask A.

Main sources of error: air in the tubing outside the bath, a slow leak, and reading before the air has reached the bath temperature. Use short tubing, check the seal, and wait for steady readings. Kim et al. (2001) and Amrani (2007) describe low-cost versions; a syringe and pressure sensor (or a phone app such as phyphox; Staacks et al., 2018) works for Boyle's law, and Santosa (2020) shows a syringe and U-tube method.

14.4 Practice problems with answers

1. What volume does 1.00 mol of gas fill at 0 °C and 1.00 atm?

V = (1.00)(0.08206)(273.15)/1.00 = 22.4 L.

2. Find the pressure of 0.500 mol in 12.0 L at 300 K.

P = 0.500 × 8.314 × 300 / 0.0120 = 1.04 × 105 Pa = 104 kPa.

3. How many moles are in a 5.00 L tank at 2.50 atm and 20.0 °C?

n = (2.50)(5.00)/(0.08206 × 293.15) = 0.520 mol.

4. 0.250 mol in 2.00 L at 3.00 atm. Find T in °C.

T = (3.00)(2.00)/(0.250 × 0.08206) = 292 K = 19 °C.

5. A gas at 100 kPa and 2.00 L is squeezed to 0.500 L at constant T. New pressure?

Boyle: P₂ = 100 × 2.00 / 0.500 = 400 kPa.

6. A 1.50 L balloon at 25 °C goes into a −18 °C freezer. New volume?

Charles: V₂ = 1.50 × 255.15 / 298.15 = 1.28 L.

7. US units: a 0.500 ft³ helium balloon at 14.7 psi and 70.0 °F. Mass of helium?

P = 101 353 Pa, V = 0.014 158 m³, T = 294.26 K → n = 0.587 mol → m = 0.587 × 4.0026 = 2.35 g.

8. Density of CO₂ (44.01 g/mol) at 1.00 atm and 25 °C?

ρ = 101 325 × 0.04401 / (8.314 × 298.15) = 1.80 g/L.

9. 0.420 g of a vapour fills 250 mL at 100 °C and 1.00 atm. Molar mass?

M = mRT/(PV) = 0.420 × 0.08206 × 373.15 / (1.00 × 0.250) = 51.4 g/mol.

10. Trap: a gas is cooled to −300 °C. What is its volume?

Not physical. −300 °C is below absolute zero (−273.15 °C), so no gas can reach it. Real gases liquefy long before 0 K anyway.

14.5 Mistakes that lose marks

  • Using °C or °F instead of kelvin.
  • Mixing litres with R = 8.314 (needs m³) or pascals with R = 0.08206 (needs atm).
  • Using gauge pressure instead of absolute pressure.
  • Forgetting to convert grams to moles with n = m/M.
  • Rounding R to 8.3 or 0.08 in the middle of a calculation.
  • Leaving the answer without a unit, or giving more significant figures than the data.
  • Applying the ideal law to a gas at very high pressure or near its boiling point without comment.

🎯 15. When to Use the Ideal Gas Law

Use PV = nRT when
  • The gas is well above its boiling point (air, N₂, O₂, He, H₂ at room temperature).
  • The pressure is below about 10 atm (often fine to 50 atm for light gases).
  • You know any three of P, V, n and T.
  • You need a quick, transparent estimate for a lab, an exam or a design check.
Use something else when
  • The gas is near condensation (steam near 100 °C, CO₂ above about 30 bar, propane in a tank).
  • The pressure is very high (gas cylinders, pipelines, deep-sea work).
  • You need better than 1 % accuracy: use van der Waals, Redlich-Kwong, Peng-Robinson or a reference equation of state.
  • The gas reacts or dissolves during the process.

15.1 Four real examples

  • Chemistry lab: the volume of hydrogen collected over water, after subtracting the water vapour pressure (Dalton's law).
  • Car tyres: a tyre at 32 psi gauge (46.7 psi absolute) and 15 °C rises to about 49 psi absolute (34 psi gauge) when it warms to 30 °C.
  • Scuba diving: an 11.1 L tank at 207 bar holds about 2.7 kg of air; the ideal law is about 1.6 % off at that pressure.
  • Weather and flight: air density at altitude, which sets lift and engine power, follows ρ = PM/(RT).

15.2 Decision tree

CheckDoes the amount of gas stay the same between two states?
YesUse the combined gas law (or Boyle, Charles, Gay-Lussac).
No, or one state onlyUse PV = nRT.
CheckIs the pressure below about 10 atm and the gas far from condensing?
YesThe ideal gas law is accurate to about 1 %.
NoCheck the van der Waals bar in Chart 4, or use a real-gas equation.
CheckIs it a mixture of gases?
YesUse total moles for total pressure; partial pressure = mole fraction × total (Dalton).
NoUse the moles of the single gas.

🔧 16. Common Mistakes and Troubleshooting

My pressure is about 12 times too small

The temperature was typed in °C but treated as kelvin. 25 °C is 298.15 K; set the unit menu to °C or add 273.15.

My answer is 1000 times too big or too small

Litres were used with R = 8.314 J/(mol·K), which needs m³. Divide litres by 1000, or use R = 0.08206 L·atm/(mol·K).

My answer is a little too low compared with the book

You may have used gauge pressure. Add 101.325 kPa (14.7 psi) to a gauge reading to get absolute pressure.

The book says 22.4 L but another source says 22.7 L

Both are right for different STPs: 22.414 L/mol at 1 atm, 22.711 L/mol at 1 bar (IUPAC STP).

I have grams, not moles

Choose g in the amount menu and enter the molar mass (or pick the gas). n = m/M.

The tool says Not physical

A temperature is at or below 0 K (−273.15 °C, −459.67 °F). Check the sign and the unit.

The van der Waals bar is very different from the ideal line

The gas is at high pressure or near condensation, so the ideal gas law is not accurate there. Use a real-gas equation for design work.

My absolute zero estimate is far from −273 °C

Look for air in tubing outside the bath, a leak, or readings taken before the gas reached the bath temperature.

My CSV loads but nothing appears

Choose the x column, click at least one other column so it turns green, then press Load selected columns as groups.

Excel gives a different answer

Check that 273.15 was added, that R matches the units, and that CONVERT unit strings are typed with the right case.

Which R should I use?

Match R to your units: 8.314 J/(mol·K) with Pa and m³ (or kPa and L), 0.08206 L·atm/(mol·K) with atm and L, 62.36 L·Torr/(mol·K) with torr and L.

⚖ 17. Assumptions and Limitations

17.1 Assumptions

  1. Molecules take up no space. At high pressure their own volume matters, so the real pressure is higher than the ideal value (the b term).
  2. Molecules do not attract each other. Attractions pull molecules back from the walls, so at moderate pressure and low temperature the real pressure is lower than ideal (the a term). This is why CO₂ at 50 bar is about 20 % below the ideal pressure.
  3. Collisions are perfectly elastic, as in the kinetic theory of Clausius (1857) and Maxwell (1860). This holds well for gases at normal conditions.
  4. Pressure is absolute and temperature is in kelvin. A gauge pressure gives an answer that is too low by the atmospheric part; a Celsius temperature gives a nonsensical answer.
  5. The gas is in equilibrium, with the same P and T throughout. A gas being compressed quickly warms up, so Boyle's law underestimates the pressure during fast compression.

17.2 Limitations

  1. Near condensation (steam, refrigerants, propane, CO₂) use a real-gas equation of state: van der Waals is the classroom model; Redlich and Kwong (1949), Soave (1972) and Peng and Robinson (1976) are standard in engineering, and Pitzer's acentric factor (Pitzer, 1955) extends them.
  2. The van der Waals check on this page uses handbook constants and is itself approximate; for design use reference data such as Lemmon et al. (2000) for air.
  3. The law says nothing about how fast a gas changes state or about heat flow; for that use thermodynamics (first law, adiabatic processes).
  4. At very low temperature or very high density, quantum effects and liquefaction make the gas law fail completely.

🏁 18. Conclusion

18.1 What the answer is

___

18.2 What it means physically

___

18.3 Watch out for

___

18.4 Next steps

___

18.5 The big picture

The ideal gas law is the simplest equation of state in science, and one of the most useful. A single line, PV = nRT, predicts how much air is in a scuba tank, why a balloon shrinks in the cold, how dense the air is at a mountain airport, and how many moles of hydrogen a reaction made. It also carries a deep idea: temperature is molecular motion, and there is an absolute zero at −273.15 °C, which you can find yourself from a flask, a thermometer and a straight line. Use kelvin, absolute pressure and the right value of R, check real-gas behaviour at high pressure, and this ideal gas law calculator gives answers you can trust and explain.

❓ 19. Frequently Asked Questions

What is the ideal gas law?

The ideal gas law is PV = nRT: pressure times volume equals moles times the gas constant times the absolute temperature. It predicts how a gas behaves when its molecules are far apart, which is true for most gases near room conditions.

What is the ideal gas law formula?

The formula is PV = nRT, where P is pressure, V is volume, n is the number of moles, R = 8.314 J/(mol·K) and T is the temperature in kelvin. Rearranged: P = nRT/V, V = nRT/P, n = PV/(RT) and T = PV/(nR).

What is R in the ideal gas law?

R is the universal gas constant, 8.314462618 J/(mol·K), which is exact since the 2019 SI redefinition. It equals Avogadro's number times the Boltzmann constant and links energy, temperature and amount of substance.

What is the value of R in L·atm?

In litre-atmosphere units, R = 0.082057 L·atm/(mol·K), usually rounded to 0.0821. Use it when pressure is in atm and volume in litres.

What are the units of the ideal gas law?

In SI units, P is in pascals, V in cubic metres, n in moles and T in kelvin, with R = 8.314 J/(mol·K). Any units work if R matches them, but temperature must always be absolute (kelvin or Rankine).

Why must temperature be in kelvin for the ideal gas law?

Temperature must be in kelvin because the law depends on absolute temperature, which is zero when molecular motion would stop. Celsius has its zero at the freezing point of water, so 25 °C must be entered as 298.15 K.

What is n in the ideal gas law?

n is the amount of gas in moles. If you know the mass instead, divide by the molar mass: n = m/M, for example 10.0 g of CO2 / 44.01 g/mol = 0.227 mol.

How do you calculate pressure with the ideal gas law?

Use P = nRT/V. For 2.00 mol at 298.15 K in 0.0100 m³, P = 2.00 × 8.314 × 298.15 / 0.0100 = 496 000 Pa, or 496 kPa (4.89 atm).

How do you find volume using the ideal gas law?

Use V = nRT/P. One mole at 273.15 K and 101 325 Pa gives V = 8.314 × 273.15 / 101 325 = 0.0224 m³, which is 22.4 L.

How do you calculate moles with the ideal gas law?

Use n = PV/(RT). A 5.00 L tank at 2.50 atm and 293.15 K holds n = 2.50 × 5.00 / (0.08206 × 293.15) = 0.520 mol.

How do you find density with the ideal gas law?

Use ρ = PM/(RT), with M in kg/mol. Dry air (M = 0.028965 kg/mol) at 101 325 Pa and 293.15 K has ρ = 1.20 kg/m³, which is 1.20 g/L.

How do you find molar mass with the ideal gas law?

Use M = mRT/(PV) or M = ρRT/P. If 0.420 g of vapour fills 0.250 L at 373.15 K and 1.00 atm, M = 0.420 × 0.08206 × 373.15 / (1.00 × 0.250) = 51.4 g/mol.

What is the difference between the ideal gas law and the combined gas law?

The ideal gas law, PV = nRT, describes one state and includes the amount of gas. The combined gas law, P1V1/T1 = P2V2/T2, compares two states of the same amount of gas, so n and R cancel out.

What are the assumptions of the ideal gas law?

The ideal gas law assumes the molecules have no volume, do not attract each other, collide elastically and move randomly. These hold well at low pressure and high temperature and fail near condensation.

When does the ideal gas law not work?

The ideal gas law fails at high pressure and low temperature, near a gas's boiling point, where molecular size and attractions matter. For example, CO2 at 50 bar and 300 K has a real pressure about 20 % below the ideal value.

What is the molar volume of a gas at STP?

At 0 °C and 1 atm, one mole of an ideal gas fills 22.414 L. At the IUPAC standard of 0 °C and 1 bar it fills 22.711 L, and at 25 °C and 1 atm it fills 24.465 L.

How do you calculate the ideal gas law in Excel?

In Excel, type =B2*8.314462618*(C2+273.15)/(D2/1000) with moles in B2, temperature in °C in C2 and volume in litres in D2; it returns the pressure in pascals. Use =B2*0.082057366*(C2+273.15)/D2 for atmospheres.

How do you calculate the ideal gas law in Python?

In Python, import R from scipy.constants and compute P = n * R * T / V with T in kelvin and V in m³. SciPy's R is the exact value 8.314462618 J/(mol·K).

How do you calculate the ideal gas law in R?

In R, set R_gas <- 8.314462618 and compute P <- n * R_gas * (T_C + 273.15) / (V_L / 1000). Fit lab data with lm(P ~ temp_C) to estimate absolute zero.

How do you solve the ideal gas law on a scientific calculator?

Type n × 8.314462618 × (T + 273.15) ÷ V in m³, or n × 0.082057366 × T in K ÷ V in L for atmospheres. For the worked problem: 2 × 0.082057366 × 298.15 ÷ 10 = 4.893 atm.

📑 20. Cite This Tool

APA 7th edition
Pushbanathan, R. (2026). Ideal gas law calculator [Interactive physics tool]. StatsUnlock. https://statsunlock.com/ideal-gas-law-calculator/
BibTeX
@misc{statsunlock_idealgas_2026, author={Pushbanathan, Reegan}, title={Ideal Gas Law Calculator}, year={2026}, publisher={StatsUnlock}, note={Interactive physics tool}, url={https://statsunlock.com/ideal-gas-law-calculator/}}
Methods sentence (fills in after Calculate)
Press Calculate to fill in a methods sentence with your values.

🔗 21. Related Tools

📖 22. Glossary of Terms

TermPlain-English meaning
Absolute pressurePressure measured from a perfect vacuum, in pascals (Pa). Gauge pressure plus atmospheric pressure.
Absolute zero0 K = −273.15 °C, the temperature where ideal-gas pressure would fall to zero.
Avogadro constant (Nₐ)6.022 140 76 × 10²³ particles per mole, exact.
Avogadro's lawAt fixed P and T, volume is proportional to the number of moles.
Boltzmann constant (k_B)1.380 649 × 10⁻²³ J/K, exact; R = Nₐ k_B.
Boyle's lawAt fixed n and T, PV is constant.
Charles's lawAt fixed n and P, V is proportional to kelvin temperature.
Combined gas lawP₁V₁/T₁ = P₂V₂/T₂ for a fixed amount of gas.
Compressibility factor (Z)Z = PV/(nRT); Z = 1 for an ideal gas.
Dalton's lawThe total pressure of a mixture equals the sum of the partial pressures.
Equation of stateAn equation linking P, V, n and T for a substance.
Gas constant (R)8.314 462 618 J/(mol·K), exact; 0.082 057 L·atm/(mol·K).
Gauge pressurePressure above atmospheric, as read by a tyre gauge.
Gay-Lussac's lawAt fixed n and V, P is proportional to kelvin temperature.
Ideal gasA model gas whose molecules have no volume and no attractions; it obeys PV = nRT exactly.
IsothermA curve of P against V at one fixed temperature.
Kelvin (K)The SI unit of temperature; K = °C + 273.15.
Molar mass (M)Mass of one mole, g/mol (kg/mol in SI).
Molar volumeVolume of one mole of gas, V/n, in L/mol.
Mole (mol)The SI unit of amount: 6.022 140 76 × 10²³ particles.
Pascal (Pa)The SI unit of pressure: 1 N/m².
STPStandard temperature and pressure: 0 °C and 1 atm (older) or 0 °C and 1 bar (IUPAC).
Van der Waals equation(P + an²/V²)(V − nb) = nRT, a real-gas correction for molecular attraction (a) and size (b).

📚 23. References

Peer-reviewed sources behind the equations, constants, real-gas models, lab methods and teaching notes in this ideal gas law calculator. Every DOI was checked against Crossref.

  1. Amrani, D. (2007). Determination of absolute zero using a computer-based laboratory. Physics Education, 42(3), 304–307. https://doi.org/10.1088/0031-9120/42/3/012
  2. Clausius, R. (1857). Ueber die Art der Bewegung, welche wir Wärme nennen. Annalen der Physik, 176(3), 353–380. https://doi.org/10.1002/andp.18571760302
  3. Kautz, C. H., Heron, P. R. L., Loverude, M. E., & McDermott, L. C. (2005a). Student understanding of the ideal gas law, Part I: A macroscopic perspective. American Journal of Physics, 73(11), 1055–1063. https://doi.org/10.1119/1.2049286
  4. Kautz, C. H., Heron, P. R. L., Shaffer, P. S., & McDermott, L. C. (2005b). Student understanding of the ideal gas law, Part II: A microscopic perspective. American Journal of Physics, 73(11), 1064–1071. https://doi.org/10.1119/1.2060715
  5. Kim, M. S., Kim, M.-H., & Ly, S.-Y. (2001). A simple laboratory experiment for the determination of absolute zero. Journal of Chemical Education, 78(2), 238. https://doi.org/10.1021/ed078p238
  6. Lemmon, E. W., Jacobsen, R. T., Penoncello, S. G., & Friend, D. G. (2000). Thermodynamic properties of air and mixtures of nitrogen, argon, and oxygen from 60 to 2000 K at pressures to 2000 MPa. Journal of Physical and Chemical Reference Data, 29(3), 331–385. https://doi.org/10.1063/1.1285884
  7. Maxwell, J. C. (1860). Illustrations of the dynamical theory of gases. Part I. On the motions and collisions of perfectly elastic spheres. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 19(124), 19–32. https://doi.org/10.1080/14786446008642818
  8. Mohr, P. J., Newell, D. B., Taylor, B. N., & Tiesinga, E. (2025). CODATA recommended values of the fundamental physical constants: 2022. Reviews of Modern Physics, 97(2), 025002. https://doi.org/10.1103/RevModPhys.97.025002
  9. Moldover, M. R., Trusler, J. P. M., Edwards, T. J., Mehl, J. B., & Davis, R. S. (1988). Measurement of the universal gas constant R using a spherical acoustic resonator. Journal of Research of the National Bureau of Standards, 93(2), 85. https://doi.org/10.6028/jres.093.010
  10. Peng, D.-Y., & Robinson, D. B. (1976). A new two-constant equation of state. Industrial & Engineering Chemistry Fundamentals, 15(1), 59–64. https://doi.org/10.1021/i160057a011
  11. Pitzer, K. S. (1955). The volumetric and thermodynamic properties of fluids. I. Theoretical basis and virial coefficients. Journal of the American Chemical Society, 77(13), 3427–3433. https://doi.org/10.1021/ja01618a001
  12. Redlich, O., & Kwong, J. N. S. (1949). On the thermodynamics of solutions. V. An equation of state. Fugacities of gaseous solutions. Chemical Reviews, 44(1), 233–244. https://doi.org/10.1021/cr60137a013
  13. Robertson, A. D., & Shaffer, P. S. (2016). University student reasoning about the basic tenets of kinetic-molecular theory, Part II: Pressure of an ideal gas. American Journal of Physics, 84(10), 795–809. https://doi.org/10.1119/1.4960215
  14. Santosa, I. E. (2020). Experiment with syringe and U-tube to determine the atmospheric pressure. Physics Education, 55(6), 065013. https://doi.org/10.1088/1361-6552/abab5c
  15. Setzmann, U., & Wagner, W. (1991). A new equation of state and tables of thermodynamic properties for methane covering the range from the melting line to 625 K at pressures up to 1000 MPa. Journal of Physical and Chemical Reference Data, 20(6), 1061–1155. https://doi.org/10.1063/1.555898
  16. Soave, G. (1972). Equilibrium constants from a modified Redlich-Kwong equation of state. Chemical Engineering Science, 27(6), 1197–1203. https://doi.org/10.1016/0009-2509(72)80096-4
  17. Span, R., & Wagner, W. (1996). A new equation of state for carbon dioxide covering the fluid region from the triple-point temperature to 1100 K at pressures up to 800 MPa. Journal of Physical and Chemical Reference Data, 25(6), 1509–1596. https://doi.org/10.1063/1.555991
  18. Staacks, S., Hütz, S., Heinke, H., & Stampfer, C. (2018). Advanced tools for smartphone-based experiments: phyphox. Physics Education, 53(4), 045009. https://doi.org/10.1088/1361-6552/aac05e
  19. Tiesinga, E., Mohr, P. J., Newell, D. B., & Taylor, B. N. (2021). CODATA recommended values of the fundamental physical constants: 2018. Reviews of Modern Physics, 93(2), 025010. https://doi.org/10.1103/RevModPhys.93.025010
  20. Wagner, W., & Pruß, A. (2002). The IAPWS formulation 1995 for the thermodynamic properties of ordinary water substance for general and scientific use. Journal of Physical and Chemical Reference Data, 31(2), 387–535. https://doi.org/10.1063/1.1461829
STATS UNLOCK · statsunlock.com · Ideal Gas Law Calculator
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Statistical Models

Important Plots & Charts

Calculators and Converters