Ideal Gas Law Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

What Is the Ideal Gas Law?

The ideal gas law is a fundamental equation in chemistry and physics that relates four key properties of a gas: pressure, volume, temperature, and amount of substance. It is written as:

PV = nRT

In words, the pressure of a gas multiplied by its volume equals the number of moles of gas times the gas constant times the absolute temperature. This simple relationship is used in classrooms, labs, and industry to predict how gases behave when conditions change.

This calculator lets you quickly solve the ideal gas law for any one of the four variables, as long as you know the other three. It is designed to match common homework, exam, and lab problems so you can focus on understanding the concepts instead of doing algebra by hand.

Ideal Gas Law Formula and Variables

The ideal gas law in symbolic form is:

P V = n R T

Where:

P (Pressure)
The force the gas exerts on the walls of its container, per unit area. In this calculator, pressure is entered in atmospheres (atm).
V (Volume)
The space the gas occupies. Here, volume is entered in liters (L).
n (Moles)
The amount of gas, measured in moles (mol). One mole corresponds to approximately 6.022 × 1023 particles (Avogadro’s number).
T (Temperature)
The absolute temperature of the gas in kelvin (K). Kelvin starts at absolute zero. To convert from degrees Celsius, use T(K) = T(°C) + 273.15.
R (Gas constant)
A proportionality constant that depends on the choice of units. For pressure in atm, volume in L, temperature in K, and moles in mol, this calculator uses:
R = 0.082057 L·atm·mol−1·K−1.

How to Use the Ideal Gas Law Calculator

The calculator is built to solve for any one of the four variables: pressure, volume, moles, or temperature. Follow these steps for a typical calculation:

  1. Choose what to solve for. Use the “Solve for” dropdown to select Pressure, Volume, Moles, or Temperature.
  2. Enter the other three values. Fill in numerical values for the remaining fields using the correct units:
    • Pressure in atm
    • Volume in L
    • Moles in mol
    • Temperature in K
    Leave the field you are solving for blank.
  3. Convert units if needed. If your data are in other units (such as kPa, Pa, or °C), convert them before entering them into the form. For example, convert °C to K with T(K) = T(°C) + 273.15.
  4. Click “Calculate”. The calculator rearranges PV = nRT automatically and computes the missing variable.

If you enter inconsistent or impossible combinations of values (for example, negative temperature in kelvin), the result may not be physically meaningful even though the equation can still be evaluated.

Rearranged Forms of PV = nRT

The calculator performs the algebra for you, but it is helpful to know how the formula looks when you solve for each variable:

  • Solve for pressure (P): P = nRTV
  • Solve for volume (V): V = nRTP
  • Solve for moles (n): n = PVRT
  • Solve for temperature (T): T = PVnR

Every ideal gas law problem can be reduced to choosing the correct rearranged form and plugging in the known values with consistent units.

Interpreting Your Results

Once you have calculated the missing variable, take a moment to check whether the answer makes sense physically and numerically.

  • Magnitude check: Compare your result with the size of your inputs. Doubling temperature in kelvin at constant pressure should double the volume. Increasing pressure at constant temperature should reduce volume.
  • Direction of change: Think in terms of simple gas laws:
    • Boyle’s law (constant T, n): P and V move in opposite directions.
    • Charles’ law (constant P, n): V and T move in the same direction.
    • Avogadro’s law (constant P, T): V is proportional to n.
    If your result contradicts these patterns, check your inputs and unit conversions.
  • Units check: Make sure the units of your answer match the calculator’s conventions (atm, L, mol, K). A volume of 0.024 L versus 24 L is a large difference that often comes from a misplaced factor of 1000.

Worked Example: Solving for Volume

This example mirrors a typical homework or lab question and shows how to solve it both by hand and with the calculator.

Problem

A sample of gas at a pressure of 1.20 atm and a temperature of 298 K contains 0.50 mol of gas. What volume does the gas occupy? Assume ideal behavior.

Step 1: Identify the knowns and unknown

  • P = 1.20 atm
  • n = 0.50 mol
  • T = 298 K
  • R = 0.082057 L·atm·mol−1·K−1
  • Unknown: V (volume in L)

Step 2: Choose the correct form of the equation

To solve for volume, use:

V = (nRT) / P

Step 3: Plug in the values

V = (0.50 mol × 0.082057 L·atm·mol−1·K−1 × 298 K) / 1.20 atm

First calculate the numerator:

0.50 × 0.082057 × 298 ≈ 12.22 L·atm

Then divide by the pressure:

V ≈ 12.22 L·atm / 1.20 atm ≈ 10.2 L

The gas occupies approximately 10.2 L.

Step 4: Solve using the calculator

  1. Select Volume in the “Solve for” dropdown.
  2. Enter 1.20 for Pressure (atm).
  3. Enter 0.50 for Moles (mol).
  4. Enter 298 for Temperature (K).
  5. Leave Volume (L) blank and click Calculate.

The calculator should return a volume close to 10.2 L, subject to rounding.

Comparison: Common Ideal Gas Law Use Cases

The table below summarizes typical situations where you might use the calculator and how the variables behave.

Use case What you know What you solve for Key relationship
Find volume of a gas sample P, n, T V V increases with T and n; decreases with P
Find pressure in a container V, n, T P P increases with T and n; decreases with V
Determine moles from measured P, V, T P, V, T n n increases with PV and decreases with T
Find temperature needed to reach a target pressure P, V, n T T increases with PV and decreases with n
Compare to Boyle’s law n, T constant P or V P &propto 1/V (inverse relationship)
Compare to Charles’ law n, P constant V or T V &propto T (direct relationship, with T in K)

Assumptions and Limitations of the Ideal Gas Law

The ideal gas law is an approximation. It works well in many situations, but not all. When you use this calculator, you are implicitly assuming the gas behaves ideally. That includes the following assumptions:

  • Gas particles have negligible volume. The particles are treated as point-like compared to the space between them.
  • No intermolecular forces. The model assumes gas particles do not attract or repel each other, except during brief collisions.
  • Perfectly elastic collisions. Collisions between gas particles and container walls do not lose kinetic energy.
  • Uniform conditions. Pressure and temperature are taken as uniform throughout the gas sample.

Under certain conditions, real gases deviate from this ideal behavior:

  • Very high pressures: Gas particles are crowded together, so their finite size and intermolecular forces matter more.
  • Very low temperatures: Attractive forces become important and gases can approach liquefaction, making PV = nRT less accurate.
  • Strongly interacting gases: Gases with strong intermolecular attractions or polar molecules can deviate from ideal predictions even at moderate conditions.

In those cases, more advanced “real gas” equations of state (such as the van der Waals equation) provide better predictions. For typical classroom and introductory lab problems, however, the ideal gas law is usually appropriate and your results from this calculator should be sufficiently accurate.

Practical Tips and Common Pitfalls

  • Always convert temperatures to kelvin. Using °C directly in PV = nRT is a common mistake that gives incorrect answers. Add 273.15 to convert °C to K.
  • Keep units consistent with R. Because this calculator uses R in L·atm·mol−1·K−1, you must enter P in atm and V in L. Convert from kPa, bar, or m3 if necessary.
  • Watch significant figures. The calculator returns a numerical value; you should round your final answer according to the precision of your given data.
  • Check for physical realism. Negative moles, negative absolute temperature, or extremely large or small volumes may indicate a data entry or unit conversion error.

Quick FAQ

When can I use the ideal gas law?

Use PV = nRT for gases at relatively low pressure and moderate temperature, where the gas is far from condensation and behaves approximately ideally. This is usually valid for many classroom and lab conditions.

What units should I use in this calculator?

Enter pressure in atm, volume in liters, moles in mol, and temperature in kelvin. These units match the value of R used internally.

How do I convert °C to K?

Use the simple relation T(K) = T(°C) + 273.15. For example, 25 °C corresponds to 298.15 K.

Is the ideal gas law accurate at high pressure?

Accuracy decreases as pressure becomes very high or temperature becomes very low. In those regimes, real gas equations are preferred. For most homework problems you will be told to assume ideal behavior.

Can this calculator handle mixtures of gases?

The calculator treats the gas sample as a single effective gas. For mixtures, you can still apply PV = nRT using the total pressure, total moles, and so on, but partial pressures and composition effects are not handled separately here.

Enter values and choose a variable to solve for.

Hold pressure by sliding volume

Click to Play. React to thermal jolts and load changes to keep ΔP within the safe band.

Score 0

Ready to balance

Best 0 Stability Buffer 100%
Target Pressure 1.00 atm Current Pressure 1.00 atm
Volume 24.4 L
Temperature 298 K
Moles 1.00 mol
Time in Range 0.0 s

Tip: Compressing the piston raises pressure; expanding volume relieves spikes from heat pulses.

Embed this calculator

Copy and paste the HTML below to add the Ideal Gas Law Calculator | Solve P, V, n or T to your website.