Ideal Gas Law Calculator

Calculate pressure, volume, temperature, or moles using PV=nRT.

Calculate any variable in the ideal gas law equation PV = nRT. Enter pressure, volume, temperature, and number of moles to solve for the unknown variable.

Updated June 2026 · How this works

Worth knowing
How It Works
The formula, explained simply

The ideal gas law calculator solves the fundamental equation PV = nRT for any unknown variable when you provide the other three. This equation describes how pressure (P), volume (V), number of moles (n), and temperature (T) relate for an ideal gas, with R being the universal gas constant.

When you select which variable to solve for, the calculator rearranges the equation automatically. For pressure: P = nRT/V. For volume: V = nRT/P. For temperature: T = PV/(nR). For moles: n = PV/(RT). The gas constant R equals 0.08314 bar⋅L/(mol⋅K) when using the units this calculator expects.

The calculation assumes your gas behaves ideally - meaning gas molecules have no size and don't attract each other. This works well for most gases at room temperature and moderate pressures. Enter your three known values and the calculator immediately shows the fourth variable, plus context about whether your result represents realistic conditions.

When To Use This
Right tool, right situation

Use the ideal gas law calculator when working with gases at moderate temperatures (above -50°C) and low to moderate pressures (below 10 bar). It excels for air, nitrogen, oxygen, carbon dioxide, and noble gases under normal laboratory or industrial conditions. Chemical engineers use it for initial design calculations before applying more complex equations.

The calculator is particularly useful for converting between different conditions - like determining how much a gas expands when heated, or what pressure develops when a fixed volume is heated. Students use it to solve textbook problems, while technicians apply it for compressed air systems, gas storage calculations, and HVAC design.

Avoid using ideal gas calculations for steam (use steam tables instead), gases near their boiling point, high-pressure systems like scuba tanks at depth, or precision work requiring accuracy better than 5%. For these applications, you need equations of state that account for molecular size and intermolecular forces.

Common Mistakes
Why results sometimes look wrong

The most common mistake is using Celsius instead of Kelvin for temperature. The ideal gas law requires absolute temperature because volume approaches zero at absolute zero (-273.15°C), not at 0°C. Using Celsius temperatures gives completely wrong results, especially for calculations involving temperature ratios.

Another frequent error is assuming the ideal gas law works for all conditions. It fails badly for gases near their condensation point, at pressures above 10 bar, or for polar molecules like water vapour. Steam tables exist because water vapour deviates significantly from ideal behaviour under most practical conditions.

People also confuse pressure units regularly. This calculator uses bar (1 bar ≈ atmospheric pressure), but many sources use atmospheres, pascals, or mmHg. Always check your pressure units match what the calculator expects. Similarly, ensure your volume is in litres, not millilitres or cubic metres, to get accurate results.

The Math
Worked examples and deeper derivation

The ideal gas law PV = nRT combines three separate gas laws discovered in the 17th and 18th centuries. Boyle's Law showed pressure and volume are inversely related (P ∝ 1/V). Charles's Law demonstrated volume increases linearly with temperature (V ∝ T). Avogadro's Law proved equal volumes contain equal numbers of molecules at the same conditions (V ∝ n).

Mathematically, these relationships combine as PV/nT = constant for any gas sample. The constant equals R = 0.08314 bar⋅L/(mol⋅K) for all ideal gases. This means doubling pressure halves volume, doubling temperature doubles volume, and doubling the amount of gas doubles volume - if other variables stay constant.

The equation breaks down when gas molecules become significant in size compared to container volume (high pressure) or when intermolecular forces become important (low temperature). Under these conditions, you need more complex equations like van der Waals: (P + a/V²)(V - b) = nRT, where 'a' and 'b' are gas-specific correction factors.

Standard conditions check
1 mole of gas at 273.15 K in 22.4 L volume
The pressure calculates to 1.013 bar, confirming standard temperature and pressure conditions.
Compressed gas cylinder
5 bar pressure, 2 L volume, 300 K temperature
The gas contains 0.401 moles, equivalent to about 9 L at standard conditions.
Heating effect
1 bar pressure, 10 L volume, 2 moles of gas
The temperature is 601.4 K (328.3°C), showing significant heating is required.
Expert Unlock
The thing most explanations skip

The compressibility factor Z = PV/(nRT) measures how far a real gas deviates from ideality. Z equals 1.0 for perfect ideal behaviour, but drops below 0.3 for CO₂ near its critical point (31°C, 74 bar). Most process engineers apply the Peng-Robinson equation of state instead of PV=nRT when Z deviates more than 5% from unity.

When does the ideal gas law stop being accurate?

What is the ideal gas constant R value to use?
The ideal gas constant R equals 0.08314 bar⋅L/(mol⋅K) when using pressure in bar, volume in litres, and temperature in Kelvin. This calculator uses this value automatically. Other common values include 8.314 J/(mol⋅K) for energy calculations and 0.0821 L⋅atm/(mol⋅K) for pressure in atmospheres.
Why do I need to use Kelvin instead of Celsius?
The ideal gas law requires absolute temperature in Kelvin because gas volume becomes zero at absolute zero (-273.15°C). Using Celsius would give negative temperatures that break the mathematical relationship. Convert Celsius to Kelvin by adding 273.15 to your Celsius temperature.
When does the ideal gas law become inaccurate?
The ideal gas law fails at very high pressures (above 10 bar), very low temperatures (near liquefaction), or with polar gases like water vapour. Real gases deviate because molecules have actual size and intermolecular forces. Use the van der Waals equation for better accuracy under extreme conditions.

Need something this doesn't cover?

Suggest a tool — we'll build it →