What is the ideal gas law?

The ideal gas law is PV = nRT: pressure × volume = moles × the gas constant × absolute temperature. Know any three of pressure, volume, moles and temperature and you can calculate the fourth. It is exact for a perfect ideal gas and a close approximation for real gases at ordinary pressures and temperatures.

The phrase ideal gas law calculator is searched about 1,900 times a month in the United States by students, teachers setting gas-law problems, and engineers doing quick vessel estimates. Almost every problem is the same small move: three of the four variables in PV = nRT are known and the fourth is wanted — calculate pressure from a filled cylinder, calculate volume from a reaction that produces gas, or calculate moles from a pressure rise. That is what the tool above does, in all four directions.

The law was assembled from experimental laws that each held two variables fixed: Boyle's law (pressure and volume inversely proportional at fixed temperature), Charles's law (volume proportional to absolute temperature at fixed pressure) and Avogadro's law (volume proportional to moles at fixed pressure and temperature). Combined, they give one statement with a single universal constant, R, the same for every gas. That universality is the deep point: at the same pressure, volume and temperature, a litre of hydrogen and a litre of carbon dioxide contain the same number of molecules, even though their masses are very different.

An ideal gas is a deliberate simplification: point particles with no volume of their own and no attraction between them. No real gas is exactly like that — see the honesty section below — but near room temperature and atmospheric pressure the simplification is excellent, typically accurate to well within a percent.

The ideal gas equation: PV = nRT

PV = nRT — pressure (P) times volume (V) equals the amount of gas in moles (n) times the gas constant (R) times the absolute temperature in kelvin (T). Rearranged, it gives P = nRT ÷ V, V = nRT ÷ P, n = PV ÷ RT and T = PV ÷ nR. One equation solves all four directions.

Read the ideal gas equation in pieces. P is pressure — the force per unit area on the container walls from billions of molecular collisions every second. V is the volume the gas fills: for a gas, always the full volume of its container. n is the amount in moles, a pure count: one mole is exactly 6.02214076 × 10²³ particles, the Avogadro constant. T is the absolute temperature in kelvin. R is the gas constant, the number that makes the units balance: R = 8.314462618 J·mol⁻¹·K⁻¹ in SI units, exact by definition since the 2019 revision of the SI.

To findFormulaNeeds
Pressure PP = nRT ÷ Vmoles, temperature, volume
Volume VV = nRT ÷ Pmoles, temperature, pressure
Moles nn = PV ÷ (RT)pressure, volume, temperature
Temperature TT = PV ÷ (nR)pressure, volume, moles

The four rearrangements are the whole skill: one formula, not four. Double the moles or the temperature and the pressure doubles at fixed volume; double the volume and the pressure halves. Heating a sealed container raises its pressure, while heating a balloon lets it expand instead — PV = nRT keeps both behaviours in one line.

How to calculate pressure, volume, moles and temperature

Three steps work for every ideal gas problem: convert the temperature to kelvin, make the pressure, volume and R agree in one unit system, then substitute into the rearranged equation for the variable you want. This calculator does the conversions for you by working in SI units internally.

Step 1: convert temperature to kelvin. Add 273.15 to a Celsius temperature; convert Fahrenheit to Celsius first (subtract 32, multiply by 5/9), then to kelvin. Room temperature, 25 °C, is 298.15 K. Skipping this step is the single most common ideal gas error.

Step 2: settle on one unit system. The equation balances only when R matches your pressure and volume units. The two systems worth knowing are the litre–atmosphere system (P in atm, V in litres, R = 0.082057 L·atm·mol⁻¹·K⁻¹) and the SI system (P in pascals, V in cubic metres, R = 8.314 J·mol⁻¹·K⁻¹), plus a popular hybrid — P in kilopascals, V in litres, R = 8.314 — that works because a kilopascal times a litre is exactly a joule. The R table below lists the values side by side. This calculator removes the problem entirely: it converts to SI, calculates with the exact value of R, and converts the answer back.

Step 3: substitute and solve. To calculate pressure, use P = nRT ÷ V; to calculate volume, V = nRT ÷ P; for moles, n = PV ÷ (RT); for temperature, T = PV ÷ (nR) — remembering the result is in kelvin. In the tool above, steps 1 and 2 happen automatically: choose the variable under Solve For, enter the other three, and read the result with its SI working underneath.

Worked examples you can check

Check 1: 1 mol at 273.15 K and 1 atm occupies 22.414 L. Check 2: a gas at 2 atm in 10 L at 300 K contains 0.8124 mol. Check 3: 0.5 mol at 300 K in 10 L exerts 1.231 atm. Run all three in the calculator above — they are the fastest way to confirm your unit choices are right.

Example 1 — the molar volume check. How much volume does 1 mole of gas occupy at 273.15 K and 1 atm? V = nRT ÷ P = 1 × 0.082057 × 273.15 ÷ 1 = 22.414 L. This is the famous molar volume, and it is the calculator's starting example: the page loads solving for volume at 1 atm, 1 mol and 273.15 K, so the first result you see is 22.414 L. If a hand calculation cannot reproduce this number, something upstream — usually the temperature or R — is wrong.

Example 2 — solving for moles. A rigid 10 L vessel holds gas at 2 atm and 300 K. n = PV ÷ (RT) = 2 × 10 ÷ (0.082057 × 300) = 0.8124 mol. In the calculator: choose solve for moles, enter 2 atm, 10 L and 300 K, and it returns 0.8124 mol with the SI working (202,650 Pa, 0.010 m³) in the breakdown. That is roughly 4.89 × 10²³ molecules; as oxygen (32.00 g/mol) it would weigh about 26.0 g — moles connect to mass through the molar mass, the job of our Molar Mass Calculator.

Example 3 — solving for pressure. A 5.0 L cylinder holds 0.40 mol of nitrogen at 20 °C = 293.15 K. P = nRT ÷ V = 0.40 × 8.314 × 293.15 ÷ 5.0 = 194.97 kPa, about 1.92 atm. Using 20 instead of 293.15 would return about 13 kPa — a kelvin slip produces a nonsense answer, not a small error.

Example 4 — solving for temperature. A 24.45 L sample contains 1.00 mol at 1.00 atm. T = PV ÷ (nR) = 24.45 ÷ 0.082057 = 297.9 K, about 24.8 °C — room temperature, as it should be: 24.45 L is the molar volume at 25 °C, not at 0 °C.

The gas constant R in common unit systems

R is one constant with many faces: 8.314 J·mol⁻¹·K⁻¹ in SI, 0.082057 L·atm·mol⁻¹·K⁻¹ with litres and atmospheres, 8.314 kPa·L·mol⁻¹·K⁻¹ with kilopascals and litres. The number changes only because the units change — always pick the R that matches your pressure and volume units.

More ideal gas answers go wrong over R than over the algebra. The constant is not unit-free: its value encodes your pressure and volume units, and mixing systems — pressure in kilopascals with R = 0.082057 — silently scales the answer by about a hundred. The table collects the forms in everyday use. This calculator sidesteps the choice by converting to SI internally; the breakdown under every result shows the R value matching your units, so you can follow the same working on paper.

Pressure unitVolume unitR valueR units
pascal (Pa)cubic metre (m³)8.314462618J·mol⁻¹·K⁻¹
kilopascal (kPa)litre (L)8.314462618kPa·L·mol⁻¹·K⁻¹
atmosphere (atm)litre (L)0.082057L·atm·mol⁻¹·K⁻¹
barlitre (L)0.083145L·bar·mol⁻¹·K⁻¹
mmHg (torr)litre (L)62.364L·mmHg·mol⁻¹·K⁻¹
atmosphere (atm)cubic metre (m³)8.2057 × 10⁻⁵m³·atm·mol⁻¹·K⁻¹

Two rows deserve a second look. The kilopascal–litre row has the same digits as the SI row, which is no coincidence: 1 kPa × 1 L = 1 joule, so the two systems are secretly the same system and R = 8.314 serves both. The mmHg row, R = 62.364, survives because older textbooks and vacuum work still quote millimetres of mercury (torr); 760 mmHg is exactly 1 atm, and 0.082057 × 760 = 62.364, as it must be. Whatever row you work in, write the units of R next to the number every time.

Molar volume and the two STP definitions

One mole of ideal gas occupies 22.414 L at 273.15 K and 1 atm, but 22.711 L at 273.15 K and 100 kPa. Both are called the molar volume at STP. The difference is not an error: the standard pressure in the STP definition was changed from 1 atm to 100 kPa by IUPAC, and textbooks have used both ever since.

Few numbers in school chemistry cause more quiet confusion than the molar volume. A student calculates 22.7 L, the mark scheme says 22.4 L, and both sides are right — under different definitions of STP (standard temperature and pressure). The standard temperature is 273.15 K (0 °C) in both definitions. The standard pressure is not: the older convention, still used by many textbooks, is 1 atmosphere (101.325 kPa), giving 8.314462618 × 273.15 ÷ 101,325 = 22.414 L. The current IUPAC convention, adopted in 1982, is 100 kPa (exactly 1 bar), giving 22.711 L.

STP definitionTemperaturePressureMolar volume
Traditional (pre-1982, many textbooks)273.15 K (0 °C)1 atm = 101.325 kPa22.414 L
IUPAC (current)273.15 K (0 °C)100 kPa = 1 bar22.711 L
SATP (ambient, for comparison)298.15 K (25 °C)100 kPa = 1 bar24.790 L

The practical rule is simple: a molar volume is meaningless until its pressure definition is stated, so state it. If your course or datasheet works at 1 atm, 22.414 L is your number; if it follows current IUPAC usage, use 22.711 L. The difference is about 1.3 percent — small, but easily enough to cost a mark. You can reproduce both figures above in seconds: set moles to 1 and temperature to 273.15 K, solve for volume, and enter the pressure first as 1 atm and then as 100 kPa. The table's third row, SATP (25 °C, 100 kPa), shows temperature moving the molar volume far more than the STP dispute does.

Temperature must be in kelvin

The T in PV = nRT is always absolute temperature in kelvin. Convert Celsius by adding 273.15. Using a Celsius number directly is the most common ideal gas mistake and makes the answer wrong by a factor of ten or more.

The reason is built into what temperature means for a gas. Pressure comes from molecular motion, and molecular motion is proportional to temperature measured from absolute zero. The Celsius scale instead sets its zero at the freezing point of water, an offset of 273.15 degrees. In absolute terms a gas at 25 °C (298.15 K) is only about 9 percent warmer than at 0 °C (273.15 K), which is why warming a sealed container from freezing to room temperature raises its pressure by about 9 percent. Plug 25 into PV = nRT where 298.15 belongs and every result shrinks by a factor of about twelve; plug in 0 and the equation predicts zero pressure, an absurdity that still appears in exam scripts every year.

The conversions are short. Kelvin from Celsius: K = °C + 273.15. Kelvin from Fahrenheit: K = (°F − 32) × 5/9 + 273.15, so 77 °F is 298.15 K. This calculator accepts all three units and converts before calculating; internally the temperature is always kelvin. Make the same habit on paper: the first line of every gas-law solution should be the temperature conversion, written out, before any substitution. Our Molarity Calculator makes the complementary point for solutions — molarity shifts slightly with temperature because liquid volumes expand.

Where the ideal gas law is used

PV = nRT is the default first calculation for gas cylinders and vessels, reaction gas yields, ventilation volumes, and weather and altitude estimates — anywhere a gas is near ordinary pressures and temperatures.

In teaching, the ideal gas law is the capstone of the gas-laws unit: Boyle, Charles and Avogadro stop being separate facts and become one tool, bridging measurable quantities — a pressure gauge, a vessel, a thermometer — and the invisible quantity chemistry runs on, the number of moles. Stoichiometry uses it constantly: a reaction produces a gas, the gas is measured, and PV = nRT converts the measurement back into moles reacted. It pairs naturally with the mole arithmetic in our Molarity Calculator and the decay mathematics in the Half-Life Calculator.

In engineering, the law sizes and checks anything that stores or moves gas: the pressure in a compressed-air receiver, the moles — and therefore the mass and running time — in an oxygen or welding-gas cylinder, and the volume a process will release into a vent line. Meteorology and aviation use the same physics in density form, density = PM ÷ (RT): it explains why hot air is less dense, why balloons rise, and why aircraft performance falls on hot days at high airfields. In every setting the law is used as this calculator uses it — a fast, transparent estimate whose assumptions the user understands.

When real gases break the law: van der Waals

The ideal gas law is an approximation, not the truth. Real gases deviate at high pressure, at low temperature, and near condensation. The van der Waals equation corrects for molecular attraction and size and is the standard next step.

Honesty about limits is part of using this tool well: no real gas obeys PV = nRT exactly. The ideal model makes two false assumptions. It treats molecules as points, but real molecules occupy space, so at high pressure the free volume is measurably less than the container volume. And it assumes no forces between molecules, but real molecules attract each other weakly, lowering the measured pressure — an effect that grows as the gas cools. Both errors are negligible near atmospheric pressure and room temperature, which is why the law earns its place; both grow as pressure rises or temperature falls toward condensation.

The standard correction is the van der Waals equation, (P + an²/V²)(V − nb) = nRT, where a encodes the attraction and b the molecular size, with tabulated values for every gas. Carbon dioxide is the textbook example: at high pressure its ideal-gas volume can be wrong by several percent, and near its critical point (about 31 °C and 74 bar) by far more. Rule of thumb: below about 5 bar and well above the boiling point, ideal answers are usually good to about 1 percent; by tens of bar, or near condensation, check with a real-gas equation instead. This calculator solves the ideal gas law only — it applies no van der Waals correction — so treat high-pressure results as first estimates, not final values.

Common ideal gas law mistakes

The five classic errors: using Celsius instead of kelvin, mixing R with the wrong units, entering millilitres or cubic centimetres as litres, quoting 22.4 L under the 100 kPa STP definition (or 22.7 L under the 1 atm one), and trusting ideal answers at high pressure where real gases deviate.

1. Forgetting kelvin. Covered above because it deserves the emphasis: convert first, always, and write the conversion down. An answer built on 25 instead of 298.15 is not slightly wrong, it is an order of magnitude wrong.

2. Mismatching R and the units. R = 0.082057 belongs with atmospheres and litres; R = 8.314 belongs with pascals and cubic metres, or kilopascals and litres. Cross them and the answer is out by a factor of about 100 or 1,000. This calculator makes the mistake impossible by converting to SI internally.

3. Volume unit slips. 500 mL is 0.500 L and 0.000500 m³; 1 m³ is 1,000 L. Gas volumes arrive in millilitres, litres and cubic metres, often in the same problem. Convert explicitly before substituting, or pick the unit next to the field and let the tool do it.

4. The STP mix-up. 22.414 L pairs with 1 atm; 22.711 L pairs with 100 kPa. Quoting one under the other's definition builds a 1.3 percent error into everything downstream.

5. Using gauge pressure as absolute pressure. PV = nRT needs absolute pressure. Gauges read pressure above atmospheric, so add roughly 101 kPa (1 atm) to a gauge reading before using it. At low working pressures this correction is proportionally huge.

6. Expecting ideal accuracy from a real gas. At high pressure, low temperature, or near liquefaction, the ideal answer is only a starting estimate, as the van der Waals section explains.

What this calculator cannot do

This calculator solves PV = nRT for one gas in one state. It applies no real-gas corrections, does not compare two states, and is not a substitute for engineering design checks on pressure vessels.

The boundaries are worth stating exactly. First, one state at a time: the tool relates P, V, n and T for a single state. Two-state problems (the combined gas law) can be done here in two passes, one per state, but the tool does not compare them for you. Second, ideal behaviour only: no van der Waals, Redlich–Kwong or compressibility correction is built in. Third, mixtures only in total: total moles return total pressure and one component's moles return its partial pressure, but the tool does not split a mixture or track mole fractions. Fourth, nothing here designs or certifies anything: pressure vessels and safety systems require codes, real-gas data and qualified review. Use this calculator for learning, checking and first estimates.

Sources & References

Source note: every source above was checked live while this page was built. The OpenStax Chemistry 2e link points to section 9.3, the chapter's ideal-gas applications, because the direct 9.2 page did not return a live response during checking; LibreTexts and Khan Academy cover the equation itself.