Skip to content
FastTool

Science & Math

Ideal Gas Law Calculator

Enter any three of pressure, volume, amount and temperature to get the fourth, in the units you work in. Every unit conversion is shown step by step. You can also compare two states at constant temperature, pressure or volume on a P–V graph and a 3D piston.

Start with a known state

Set the conditions

Initial state

Use absolute pressure, not gauge pressure. Changing a unit converts the value already in the field.

The volume, made visibleWaiting for a valid state
IDEAL MODEL

Drag or use the arrow keys to rotate. Click the view before scrolling to zoom. Piston height shows volume, not the size of a real vessel.

The 48 dots are an illustration, not simulated molecules.
Pressure · absolute
—
kPa
Volume
—
L
Temperature
—
K
Amount · unchanged on path
—
mol

Results will appear here.

Pressure × volume

A path you can read.

Initial Final Inspected
Pressure–volume diagramCalculate a valid state to display the graph.

Single-state mode plots one point. Compare mode plots 101 equilibrium states along the selected constraint. Axes start at zero.

Table of values: initial, intermediate and final states
No calculation yet
PathP (kPa absolute)V (L)n (mol)T (K)

Nothing hidden in the units

Follow the calculation.

  1. Enter three known quantities.
Equation check at the inspected statePV = nRTPa × m³ = joules

How it works

How the ideal gas law works.

One equation, four useful answers.

An ideal gas links its absolute pressure P, volume V, amount n and kelvin temperature T. Three known values determine the fourth.

PV = nRT
R = 8.31446261815324 J mol⁻¹ K⁻¹

At 298.15 K, 1 mol occupying 24.465403697 L gives 101.325 kPa, which is 1 atm.

“STP” needs a pressure.

Both presets use 273.15 K and 1 mol. At 100 kPa the ideal volume is 22.710955 L. At 1 atm (101.325 kPa) it is 22.413970 L.

1 atm = 101325 Pa
1 bar = 100000 Pa
1 L = 0.001 m³

Check which standard pressure your course or problem uses. IUPAC defines STP with 100 kPa; many textbooks, including OpenStax, still use 1 atm.

Change a condition, not everything.

Compare mode keeps n constant. Halve V at constant T and P doubles. Double V at constant P and kelvin T doubles. At constant V, P changes in proportion to kelvin T.

Isothermal: P₁V₁ = P₂V₂
Isobaric: V₁/T₁ = V₂/T₂
Isochoric: P₁/T₁ = P₂/T₂

These are before-and-after comparisons of the same gas. Heat, work and timing are not part of the calculation.

Worked example: air in a bottle.

A 2.0 L bottle holds 0.10 mol of air at 25 °C. What is the pressure inside? Choose P as the unknown, then enter V = 2 L, n = 0.1 mol and T = 25 °C.

T = 25 + 273.15 = 298.15 K
V = 2 L = 0.002 m³
P = nRT ÷ V = 0.1 × 8.3145 × 298.15 ÷ 0.002
P ≈ 123,948 Pa ≈ 123.95 kPa

That is about 1.22 atm, a little above normal air pressure.

Worked example: squeeze it slowly.

Start with 1 mol at 298.15 K in 24.465 L, which is 101.325 kPa. Choose “Compare two states”, hold temperature constant and set the final volume to 12.233 L.

P₂ = P₁V₁ ÷ V₂ = 101.325 × 24.465 ÷ 12.233
P₂ ≈ 202.65 kPa

Halving the volume at constant temperature doubles the pressure. Drag “Inspect the path” to see each state in between.

Absolute, not gauge.

A tire or tank gauge shows pressure above the surrounding air. The gas law needs absolute pressure, so add the air pressure first.

P(absolute) = P(gauge) + 101.325 kPa

A tire reading 220 kPa on the gauge is about 321 kPa absolute at sea level.

What value of R should I use?

Here you don’t need to choose: the calculator converts everything to SI units and uses R = 8.31446261815324 J/(mol·K). If you work by hand, match R to your units: 8.314 L·kPa/(mol·K), 0.08206 L·atm/(mol·K) or 0.08314 L·bar/(mol·K).

Why must temperature be in kelvin?

The law needs temperature measured from absolute zero. Warming a gas from 10 °C to 20 °C does not double its pressure: in kelvin it goes from 283.15 K to 293.15 K, a rise of about 3.5%. You can type °C or °F; the calculator converts to kelvin before it solves.

Does the ideal gas law work for real gases?

It is close for most gases near room temperature and ordinary pressures. It ignores the size of the molecules and the forces between them, so it drifts at high pressure, at low temperature and near condensation. For pressure vessels or gas handling, use measured data and the rules that apply to your work.

Why is a value rejected?

Each quantity has a numeric range in SI units: pressure 10⁻⁶–10⁹ Pa, volume 10⁻¹²–10⁶ m³, amount 10⁻¹²–10⁹ mol and temperature 0.001–100,000 K. Inputs and the solved value must stay inside them. Pressure, volume and amount must be above zero, and temperature above absolute zero. Use a dot for decimals; scientific notation such as 2.5e-3 works too.

What do the particles and downloads represent?

The piston height shows volume relative to the larger endpoint. For extreme ratios, the smaller chamber can appear as a very thin layer. The cylinder is not a dimensioned design. Its 48 markers do not represent molecule counts, measured speeds or physical collisions. Animation is off by default and is silent.

JSON includes your known inputs with their original units, the solved state, the selected path, the final state, the inspected fraction and 101 path samples in SI units (one in single-state mode). CSV has the same sample values, inputs and fraction. The solved quantity is blank in CSV and null in JSON because you didn’t enter it. Runs in your browser. Nothing is uploaded, and your settings aren’t saved.

Sources and method

Equation and path conventions: OpenStax Chemistry 2e, §9.2. Constant: NIST molar gas constant. Exact defining constants: BIPM kelvin and BIPM mole. R = NAkB; arithmetic uses JavaScript double precision.

Found a mistake? Tell us.