What Is the Ideal Gas Law?
The ideal gas law is one of the most useful equations in chemistry and physics. It describes how pressure, volume, temperature, and the amount of a gas are related to one another in a single, simple formula. Whenever you need to answer a question like "how to calculate pressure of a gas in a sealed container?" or "what volume will this gas occupy at a given temperature?", the ideal gas law is the starting point.
The equation is:
PV = nRT
Each symbol stands for a measurable property of the gas:
- P — Pressure, most often measured in atmospheres (atm), kilopascals (kPa), or millimeters of mercury (mmHg).
- V — Volume, the space the gas occupies, usually measured in liters (L).
- n — Amount of gas, measured in moles (mol). One mole contains 6.022 × 10²³ particles.
- T — Absolute temperature, which must always be in kelvin (K). This is the single most important detail in the entire calculation.
- R — The ideal gas constant, a fixed number that ties all the units together. When pressure is in atm, volume in liters, and temperature in kelvin, R = 0.082057 L·atm/(mol·K).
The law is called "ideal" because it assumes gas particles have no volume of their own and do not attract or repel each other. Real gases only approximate this behavior, but under everyday conditions — normal temperatures and pressures — the approximation is remarkably accurate.
How to Use the Ideal Gas Law Calculator
Our free ideal gas law calculator solves the PV=nRT equation for any one of the four variables. Follow these steps:
Step 1: Choose the variable you want to find
Select Pressure (P), Volume (V), Moles (n), or Temperature (T) at the top of the calculator. The input box for that variable is automatically disabled, since it is the unknown.
Step 2: Enter the three known values
Type in the values you know. Pay attention to the units shown next to each box:
- Pressure can be entered in atm or kPa — the calculator converts kPa to atm automatically (1 atm = 101.325 kPa).
- Volume is entered in liters.
- Moles are entered in mol.
- Temperature can be entered in kelvin or degrees C — degrees C are converted to kelvin by adding 273.15.
Step 3: Read the result and the worked steps
Press Calculate. The result appears along with the rearranged formula used and a step-by-step breakdown showing the unit conversions, the substitution, and the final value. Pressure answers also show the equivalent in kPa and mmHg, and temperature answers show degrees C as well.
Unit notes
The gas constant R = 0.082057 only matches pressure in atm, volume in liters, and temperature in kelvin. If you enter pressure in kPa, the calculator first divides by 101.325 to convert to atm before applying the formula, so the internal math always stays consistent.
Worked Examples
Example 1: Find the pressure of a gas in a container
A rigid 12.0 L steel cylinder holds 0.50 mol of nitrogen gas at 300 K. What is the pressure inside?
We need P, so use P = nRT / V. Substituting: P = (0.50 mol × 0.082057 × 300 K) / 12.0 L = 1.0257 atm, roughly 1.03 atm. In more familiar terms, that is about 104 kPa or 779 mmHg.
Example 2: Find the volume of a gas at STP
How much space does 2.0 mol of an ideal gas occupy at standard temperature and pressure (STP: 273.15 K, 1 atm)?
We need V, so use V = nRT / P. Substituting: V = (2.0 × 0.082057 × 273.15) / 1.0 = 44.8 L. This is why chemists remember that one mole of gas occupies about 22.4 L at STP.
Example 3: Find the number of moles in a sample
A weather balloon with a volume of 850 L is filled with helium at 0.95 atm and 285 K. How many moles of helium does it contain?
We need n, so use n = PV / RT. Substituting: n = (0.95 × 850) / (0.082057 × 285) = 34.5 mol of helium.
You can reproduce all three answers instantly by entering the numbers into the PV=nRT calculator above.
Where the Ideal Gas Law Comes From
PV = nRT was not discovered in one experiment. It is the merger of four simpler relationships, each found by varying one property of a gas while holding the others still:
- Boyle's law: at constant temperature and amount, pressure and volume are inversely proportional, P1V1 = P2V2. Squeeze a gas to half its volume and its pressure doubles.
- Charles's law: at constant pressure and amount, volume is proportional to absolute temperature, V1/T1 = V2/T2. This is why a balloon shrinks in cold air.
- Gay-Lussac's law: at constant volume and amount, pressure is proportional to absolute temperature, P1/T1 = P2/T2 — the reason a sealed aerosol can becomes dangerous when heated.
- Avogadro's law: at the same temperature and pressure, equal volumes of gas contain equal numbers of moles, whatever the gas.
When the amount of gas stays fixed but pressure, volume and temperature all change together, the four merge into the combined gas law, P1V1/T1 = P2V2/T2. Add the amount back in and you get the full ideal gas law. A useful memory anchor: the combined law handles before-and-after problems, while PV = nRT handles single-state problems.
A note on STP
Standard temperature and pressure (STP) means 0 °C (273.15 K), but the pressure half of the definition depends on the source. Older textbooks and most chemistry courses use 1 atm, which makes one mole of gas occupy 22.4 L — the figure in Example 2 above — while the modern IUPAC standard uses 100 kPa, giving a molar volume of 22.7 L. Neither is wrong; just check which convention a problem expects before comparing answers.
Units and Conversions
Getting the units right is half the battle with the ideal gas law. Here are the conversions you will use most often.
Pressure conversions
- 1 atm = 101.325 kPa = 760 mmHg = 760 torr = 14.696 psi
- To convert kPa to atm: divide by 101.325
- To convert mmHg to atm: divide by 760
Volume conversions
- 1 L = 1000 mL = 1 dm³
- To convert mL to liters: divide by 1000
Temperature conversions
- K = °C + 273.15
- °C = K − 273.15
The temperature conversion is not optional. The ideal gas law is a proportionality law — pressure is proportional to absolute temperature — so it only works on a scale where zero means "no molecular motion." That scale is kelvin. Using degrees C (or Fahrenheit) in PV=nRT will give a wrong answer every time.
The Gas Constant R: Values for Every Unit System
The value of R depends entirely on the units you use. Pick the row that matches your units:
- 0.082057 L·atm/(mol·K) — pressure in atm, volume in liters (used by this calculator)
- 8.314 J/(mol·K) or 8.314 L·kPa/(mol·K) — the SI value, used with pascals and cubic meters
- 62.36 L·mmHg/(mol·K) — pressure in mmHg (torr), volume in liters
- 1.987 cal/(mol·K) — used in thermochemistry when energy is in calories
- 0.08314 L·bar/(mol·K) — pressure in bar, volume in liters
All of these are the same physical constant expressed in different units. Mixing them up — for example, using 8.314 with pressure in atm — is one of the most common calculation errors.
Real-World Applications
The ideal gas law is not just a classroom exercise. It shows up constantly in practical situations:
Scuba diving
As a diver descends, water pressure squeezes the air in the tank and in the diver's lungs. The ideal gas law explains why the same tank delivers fewer breaths at depth: at higher pressure, a fixed tank volume holds more moles of air, and those moles are consumed faster.
Car and bicycle tires
A tire is a nearly fixed-volume container. On a hot day, the temperature of the trapped air rises, and since V and n are constant, P must rise. That is the ideal gas law in action — and why tire pressure should be checked when tires are cold.
Weather balloons
A weather balloon rises because the surrounding air pressure drops with altitude, letting the helium inside expand. Balloon designers use PV=nRT to predict how large the balloon must be at launch so it reaches the right size — but not so large that it bursts — at cruising altitude.
More everyday uses
Airbags deploy using gas-generating reactions sized by the ideal gas law; aerosol cans warn against heat because pressure climbs with temperature; and industrial chemists size reactors and storage vessels from it daily.
Assumptions and Limitations: Ideal vs. Real Gases
The law works so well because its assumptions are close enough to reality for most gases at ordinary conditions. But every assumption has a breaking point:
- Gas particles have no volume. At very high pressures, molecules are packed tightly and their own volume becomes significant. The measured pressure then deviates from the ideal prediction.
- No forces between particles. At low temperatures, attractive forces between molecules matter — this is exactly why gases liquefy. Near condensation points, real gases depart strongly from ideal behavior.
- Perfectly elastic collisions. This holds well for simple gases but breaks down for complex molecules at extreme conditions.
Engineers handle these cases with corrected equations such as the van der Waals equation, which adds terms for molecular size and attraction. As a rule of thumb: at pressures near 1 atm and temperatures well above the gas's boiling point, the ideal gas law is accurate to within a few percent. Nitrogen, oxygen, helium, and hydrogen behave nearly ideally under normal lab conditions.
Common Mistakes to Avoid
- Forgetting to convert to kelvin. This is the number-one error. Room temperature is 25 °C = 298.15 K, not 25.
- Mixing up R values. Use 0.082057 with atm and liters, or 8.314 with SI units — never mix them.
- Using gauge pressure instead of absolute pressure. Tire gauges read pressure above atmospheric; the gas law needs absolute pressure, so add ~1 atm (14.7 psi) to a gauge reading.
- Confusing moles and grams. Convert mass to moles using molar mass (n = mass / molar mass) before plugging into the equation.
- Using volume in mL without converting. Divide milliliters by 1000 to get liters first.
Keep these five checks in mind, and the ideal gas law calculator above will give you reliable answers every time.
Frequently Asked Questions
What is the ideal gas law?
The ideal gas law is the equation PV = nRT, which relates the pressure (P), volume (V), temperature (T), and amount in moles (n) of a gas through the gas constant R. It lets you calculate any one of these four quantities when you know the other three.
What is the value of R, the ideal gas constant?
The value of R depends on the units used. With pressure in atmospheres, volume in liters, and temperature in kelvin, R = 0.082057 L·atm/(mol·K). In SI units it is 8.314 J/(mol·K), and with pressure in mmHg it is 62.36 L·mmHg/(mol·K). Always match R to your units.
Why must temperature be in kelvin?
The ideal gas law is a proportionality: pressure is proportional to absolute temperature. Kelvin starts at absolute zero, where molecular motion stops, so the proportionality holds. Using Celsius or Fahrenheit breaks the math and gives wrong answers. Convert with K = °C + 273.15.
When does the ideal gas law break down?
The law assumes gas particles have no volume and exert no forces on each other. It becomes inaccurate at very high pressures, where molecules are crowded together, and at very low temperatures, where attractive forces cause condensation. Under ordinary lab conditions it is typically accurate within a few percent.
What units should I use in the calculator?
Enter pressure in atm or kPa (the calculator converts kPa automatically), volume in liters, moles in mol, and temperature in kelvin or degrees C (converted automatically). Results for pressure also show kPa and mmHg equivalents, and temperature results show degrees C.
How does this ideal gas law calculator work?
Choose which variable to solve for — P, V, n, or T. The calculator rearranges PV = nRT into the matching formula (for example, P = nRT / V), converts your inputs to consistent units, computes the answer, and shows each step so you can verify the result.
What is the molar volume of a gas at STP?
At 0 °C and 1 atm, one mole of any ideal gas occupies about 22.4 L (22.414 L precisely, as in Example 2). Under the modern IUPAC definition of STP, which uses 100 kPa instead of 1 atm, the molar volume is 22.7 L. The gas itself does not matter — the value is the same for helium, oxygen, or carbon dioxide.
How do I convert grams to moles for the ideal gas law?
Divide the mass by the gas's molar mass: n = mass / M. For example, 22.0 g of carbon dioxide (M = 44.01 g/mol) is 22.0 / 44.01 = 0.50 mol, ready to use in PV = nRT. Common molar masses are 2.02 g/mol for hydrogen, 4.00 for helium, 28.02 for nitrogen, and 32.00 for oxygen.
