Skip to main content
chemistrycalculatorguide

Ideal Gas Law Calculator: PV = nRT Explained with Worked Examples

·12 min read·Solvify Team

An ideal gas law calculator solves PV = nRT for whichever variable you don't already know — pressure, volume, moles, or temperature — once you plug in the other three. The equation connects four measurable properties of a gas into a single relationship, and it is one of the most-used formulas in general chemistry, from finding the volume of a gas produced in a reaction to predicting how a weather balloon expands as it rises. This guide walks through the formula and its constant R, the exact algebra for isolating each variable, two fully worked numeric examples, the unit-conversion mistakes that cost the most points, and practice problems with checked answers.

What Is an Ideal Gas Law Calculator and What Does PV = nRT Mean?

An ideal gas law calculator applies the equation PV = nRT, where P is pressure, V is volume, n is the number of moles of gas, T is absolute temperature, and R is the ideal gas constant. The equation models a hypothetical "ideal" gas — one whose particles have no volume of their own and no attraction to one another — but real gases like air, oxygen, or carbon dioxide follow it closely enough at ordinary classroom pressures and temperatures that the formula works for almost every general chemistry problem you'll see. Each variable has to be in specific units for the equation to balance correctly. Pressure P is typically in atmospheres (atm) or kilopascals (kPa), volume V in liters (L), amount n in moles (mol), and temperature T in kelvin (K) — never Celsius or Fahrenheit, because the gas law is built on absolute temperature, where 0 K is absolute zero. An ideal gas law calculator saves you from re-deriving the algebra every time, but the unit conversions are exactly where most hand calculations go wrong, so this guide treats them as their own step rather than an afterthought. The equation shows up far beyond the chemistry classroom. Engineers use it to size compressed-air tanks and calculate how much oxygen a scuba cylinder holds at depth. Meteorologists use it to model how a weather balloon's volume expands as atmospheric pressure drops with altitude. Even a bag of chips puffing up on an airplane, or a car tire's pressure reading changing between a cold morning and a hot afternoon, is a real-world instance of PV = nRT in action — one variable changes (altitude-driven pressure, or temperature), and the others respond in a predictable, calculable way.

PV = nRT — pressure times volume equals moles times the gas constant times absolute temperature. Get the units wrong and the number comes out wrong even if the algebra is perfect.

What Is the Gas Constant R, and Which Value Should You Use?

The gas constant R links the units on both sides of PV = nRT, and its numeric value changes depending on which pressure and volume units your problem uses. Picking the wrong version of R is the single most common error students make, even when every other step is correct. A useful reference point: at standard temperature and pressure (STP, defined as 0°C / 273.15 K and 1 atm), one mole of any ideal gas occupies 22.4 L. If a calculated answer is wildly different from that scale for roughly one mole of gas near room conditions, it's a strong signal that the wrong version of R was used somewhere in the substitution.

1. R = 0.0821 L·atm/(mol·K)

Use this value whenever pressure is given in atmospheres (atm) and volume is in liters (L) — the combination that shows up in the large majority of textbook and homework problems.

2. R = 8.314 J/(mol·K) or 8.314 L·kPa/(mol·K)

Use this value when pressure is in kilopascals (kPa) or when the problem is framed in SI/energy units (joules). This version of R is more common in physics-flavored chemistry courses and in problems that connect the gas law to work or energy.

3. R = 62.36 L·mmHg/(mol·K)

Use this value when pressure is given in millimeters of mercury (mmHg) or torr, which is common in older textbooks and lab manometer readings.

Match R to your pressure unit first, before you touch any other number — everything else in the calculation depends on that choice being right.

How Do You Rearrange PV = nRT to Solve for Any Variable?

An ideal gas law calculator is really just doing basic algebra on one equation, rearranged four different ways depending on which variable is unknown. Once you can isolate any one of P, V, n, or T by hand, you can check any calculator's output instantly.

1. Solving for pressure

P = nRT / V — divide both sides of PV = nRT by V.

2. Solving for volume

V = nRT / P — divide both sides by P.

3. Solving for moles

n = PV / (RT) — divide both sides by RT.

4. Solving for temperature

T = PV / (nR) — divide both sides by nR.

Whichever variable you're solving for, isolate it the same way you would in any algebra equation: move everything else to the other side by dividing.

Worked Example 1: How Do You Find the Volume of a Gas?

A 0.500 mol sample of nitrogen gas is held at a pressure of 1.20 atm and a temperature of 298 K. What volume does the gas occupy? This is a direct application of V = nRT / P, using R = 0.0821 L·atm/(mol·K) because pressure is given in atmospheres.

1. Step 1 — Confirm units match the R value

n = 0.500 mol, P = 1.20 atm, T = 298 K (already in kelvin, no conversion needed). These units match R = 0.0821 L·atm/(mol·K), so no conversions are required before substituting.

2. Step 2 — Substitute into V = nRT / P

V = (0.500 mol × 0.0821 L·atm/(mol·K) × 298 K) / 1.20 atm

3. Step 3 — Multiply the numerator

0.500 × 0.0821 = 0.04105. Then 0.04105 × 298 = 12.233 L·atm.

4. Step 4 — Divide by pressure

V = 12.233 L·atm / 1.20 atm = 10.19 L (rounded to 4 significant figures, matching the 3-sig-fig precision of the given data means the answer is best reported as 10.2 L).

5. Step 5 — Check the answer

Sanity check: 1 mole of an ideal gas at 1 atm and 273 K occupies 22.4 L (standard molar volume). Here we have roughly half a mole at a slightly higher temperature and slightly higher pressure than standard conditions, so a volume near 10 L — a bit less than half of 22.4 L due to the higher pressure — is reasonable.

10.2 L — always sanity-check a gas law answer against the familiar 22.4 L/mol at standard temperature and pressure.

Worked Example 2: How Do You Find Moles of Gas from Pressure and Volume?

A rigid 5.00 L cylinder holds oxygen gas at a pressure of 3.50 atm and a temperature of 310 K. How many moles of oxygen are in the cylinder? This uses n = PV / (RT), again with R = 0.0821 L·atm/(mol·K).

1. Step 1 — List known values in matching units

P = 3.50 atm, V = 5.00 L, T = 310 K. All three already match the units required by R = 0.0821 L·atm/(mol·K).

2. Step 2 — Substitute into n = PV / (RT)

n = (3.50 atm × 5.00 L) / (0.0821 L·atm/(mol·K) × 310 K)

3. Step 3 — Compute the numerator and denominator separately

Numerator: 3.50 × 5.00 = 17.5 L·atm. Denominator: 0.0821 × 310 = 25.451 L·atm/mol.

4. Step 4 — Divide

n = 17.5 / 25.451 = 0.6876 mol, which rounds to 0.688 mol.

5. Step 5 — Check the answer

Plug 0.688 mol back into PV = nRT: (0.688)(0.0821)(310) = 17.51 L·atm ≈ P × V = 3.50 × 5.00 = 17.5 L·atm. The two sides match within rounding, confirming the answer.

0.688 mol of O₂ — plugging the answer back into PV = nRT is the fastest way to catch an arithmetic slip before it costs you the whole problem.

What Common Mistakes Break an Ideal Gas Law Calculation?

Almost every wrong answer in a gas law problem traces back to one of a small number of unit or setup errors, not a misunderstanding of the algebra itself.

1. Forgetting to convert Celsius to kelvin

T must be in kelvin: K = °C + 273.15. Plugging in 25°C directly instead of 298.15 K produces an answer that's wrong by a large margin, since the gas law only works with absolute temperature.

2. Mismatching pressure units and R

If pressure is given in kPa or mmHg, either convert it to atm first or switch to the version of R that matches those units (8.314 or 62.36). Mixing atm-based R with a kPa pressure value is a very common exam mistake.

3. Using volume in mL instead of L

R = 0.0821 L·atm/(mol·K) requires volume in liters. Convert milliliters to liters by dividing by 1000 before substituting.

4. Confusing moles with mass

PV = nRT uses moles (n), not grams. If a problem gives mass, convert to moles first using n = mass / molar mass before using the gas law.

5. Rounding intermediate steps too early

Carrying only 2 significant figures through a multi-step calculation (mass → moles → gas law, for example) can shift the final answer noticeably. Keep at least 4 significant figures in intermediate steps and round only the final result to match the precision of the given data.

Unit mismatches, not algebra mistakes, cause the vast majority of wrong ideal gas law answers.

How Is the Ideal Gas Law Different from the Combined Gas Law?

The ideal gas law, PV = nRT, applies to a single state of a gas sample — one specific pressure, volume, moles, and temperature at one moment. The combined gas law, P₁V₁/T₁ = P₂V₂/T₂, instead compares the same fixed amount of gas (n stays constant) between two different states, such as before and after heating a sealed container. If moles of gas don't change between the two conditions in a problem, the combined gas law is often faster because R and n cancel out of the equation entirely. If the problem asks you to find pressure, volume, moles, or temperature from a single set of conditions — or if the amount of gas is changing — go back to PV = nRT.

1. When to use PV = nRT

Use it whenever you're given one complete state of a gas and asked to find the missing fourth variable, or when moles of gas are involved directly (such as finding grams produced in a reaction).

2. When to use P₁V₁/T₁ = P₂V₂/T₂

Use it when the same sealed amount of gas moves between two different pressure/volume/temperature conditions, such as a gas cylinder heated from one temperature to another.

3. Quick combined gas law example

A sealed 2.00 L container of gas at 1.00 atm and 300 K is heated to 450 K. Find the new pressure. Since V stays constant, P₁/T₁ = P₂/T₂, so P₂ = P₁ × (T₂/T₁) = 1.00 atm × (450/300) = 1.00 × 1.5 = 1.50 atm. Notice R and n never entered the calculation — that's the speed advantage of the combined gas law when moles are fixed.

If the amount of gas (n) is fixed and you're comparing two states, the combined gas law is usually the faster path — no R and no moles required.

Practice Problems: Can You Solve These Ideal Gas Law Problems?

Work through each problem by hand before checking the answer. All three use R = 0.0821 L·atm/(mol·K) unless the units require a different version.

1. Problem 1 — Find pressure

A 2.00 mol sample of helium gas occupies 15.0 L at 273 K. Find the pressure. Answer: P = nRT/V = (2.00)(0.0821)(273)/15.0 = 44.83/15.0 = 2.99 atm.

2. Problem 2 — Find temperature

A 1.50 mol sample of gas occupies 8.00 L at a pressure of 2.00 atm. Find the temperature in kelvin. Answer: T = PV/(nR) = (2.00)(8.00)/[(1.50)(0.0821)] = 16.0/0.12315 = 129.9 K.

3. Problem 3 — Find moles from mass

A sample of CO₂ gas (molar mass 44.0 g/mol) has a mass of 8.80 g and is held at 1.00 atm and 300 K. Find its volume. First convert mass to moles: n = 8.80 g / 44.0 g/mol = 0.200 mol. Then V = nRT/P = (0.200)(0.0821)(300)/1.00 = 4.926 L, which rounds to 4.93 L.

4. Problem 4 — Find pressure with a kPa-based R

A 3.00 mol sample of nitrogen gas occupies 20.0 L at 320 K. Find the pressure in kPa. Use R = 8.314 L·kPa/(mol·K) since the answer is required in kPa. P = nRT/V = (3.00)(8.314)(320)/20.0 = 7981.44/20.0 = 399.1 kPa. Check: converting 399.1 kPa to atm (÷101.325) gives about 3.94 atm — a reasonable pressure for 3 moles of gas in a 20 L container at that temperature.

If your answer for Problem 3 came out near 4.93 L, your unit setup and algebra are both solid — that's exactly the kind of two-step problem (mass → moles → gas law) that shows up most often on exams.

How Can Solvify's Ideal Gas Law Calculator Help You Check Your Work?

Once you understand how to rearrange PV = nRT and pick the right value of R, an ideal gas law calculator becomes a way to check your own work rather than a substitute for understanding it. Solvify's step-by-step chemistry solver shows the full substitution, the unit handling, and the arithmetic for gas law problems, so you can compare your handwritten work line by line against the calculator's steps and catch exactly where a mistake happened rather than just seeing that the final number is different. A practical workflow: solve the problem by hand first, writing out every unit conversion explicitly. Then check your final answer and, if it doesn't match, walk through the calculator's steps to find the exact line where your work diverges — usually a missed kelvin conversion, a mismatched R, or an early rounding error. That comparison teaches the material far better than reading a solved answer alone, because it forces you to locate your own specific mistake instead of just re-copying a correct method.

The goal of any ideal gas law calculator should be to confirm your reasoning, not replace it — work the algebra by hand first, then check.
Tags:
chemistrycalculatorguide

Get Homework Help Now

Join millions of students using our AI math solver for homework help. Get instant solutions to math problems, step-by-step explanations, and 24/7 homework assistance.

Available for iOS and Android devices