Ideal Gas Law (PV = nRT)Free online science calculator — instant results, no sign-up
Solve the ideal gas law for pressure, volume, moles or temperature — set one to 0.
Sign in to save results and favorites.
About the Ideal Gas Law (PV = nRT)
The Ideal Gas Law (PV = nRT) calculator solves for pressure, volume, moles, or temperature by treating the single input set to 0 as the unknown. It uses pressure in atmospheres, volume in liters, amount in moles, and temperature in kelvin. The default inputs do not identify an unknown, so they produce a validation error rather than a calculated result.
- Pressure (0 to solve) (atm)
- The absolute gas pressure in atmospheres (atm), with a default of 1; enter 0 to solve for pressure.
- Volume (0 to solve) (L)
- The volume occupied by the gas in liters (L), with a default of 22.4; enter 0 to solve for volume.
- Moles (0 to solve) (mol)
- The amount of gas in moles (mol), with a default of 1; enter 0 to solve for moles.
- Temperature (0 to solve) (K)
- The absolute gas temperature in kelvin (K), with a default of 273.15; enter 0 to solve for temperature.
Formula and method
PV = nRT. Rearranged for the selected unknown: P = nRT/V; V = nRT/P; n = PV/(RT); T = PV/(nR). These equations apply only after exactly one input is set to 0; the default example stops at validation.
- PAbsolute pressure in atmospheres (atm).
- VGas volume in liters (L).
- nAmount of gas in moles (mol).
- RIdeal gas constant, approximately 0.082057 L·atm·mol⁻¹·K⁻¹ for these units.
- TAbsolute temperature in kelvin (K).
First, count how many inputs equal 0. If the count is not exactly one, report the validation error instead of solving. Otherwise, treat that zero as an unknown marker, select the corresponding rearrangement of PV = nRT, and calculate from the other three values using a gas constant compatible with liters and atmospheres. With the exact defaults P = 1 atm, V = 22.4 L, n = 1 mol, and T = 273.15 K, there are no zero inputs, so the worked example returns: Error = Set exactly one value to 0 to solve for it.
Worked example
These are the calculator's starting values and the results it actually produces for them.
Inputs
- Pressure (0 to solve)1 atm
- Volume (0 to solve)22.4 L
- Moles (0 to solve)1 mol
- Temperature (0 to solve)273.15 K
Results
- ErrorSet exactly one value to 0 to solve for it
How to use the Ideal Gas Law (PV = nRT)
- 1Choose whether you want to find pressure, volume, moles, or temperature.
- 2Set exactly that input to 0, leaving the other three inputs nonzero.
- 3Enter the three known quantities in atm, L, mol, and K as appropriate, using absolute pressure and absolute temperature.
- 4Run the calculation and read the solved quantity in its corresponding input unit.
- 5If you retain all defaults—1 atm, 22.4 L, 1 mol, and 273.15 K—the output is Error = Set exactly one value to 0 to solve for it; select one unknown before trying again.
Reading your result
In the supplied worked example, the only output row is Error = Set exactly one value to 0 to solve for it. This means no unknown was selected, not that the gas conditions were tested and found inconsistent. For a valid solve, interpret the result as the selected unknown: pressure in atm, volume in L, amount in mol, or temperature in K. The input 0 is a selection marker, not a physical value used in the equation.
Limitations
The ideal gas law assumes negligible molecular volume and intermolecular forces. Real gases can deviate substantially at high pressures, low temperatures, or near condensation. Known quantities should be positive, temperature must be in kelvin, and pressure must be absolute rather than gauge pressure. Exactly one unknown can be solved at a time; this tool is not a four-input consistency check. The supplied example shows only validation, so it does not establish the calculator's exact gas-constant precision or result rounding.
Common questions
Why do the default values produce an error instead of a gas-law result?+
The defaults are pressure 1 atm, volume 22.4 L, moles 1 mol, and temperature 273.15 K. None is 0, so the calculator cannot identify which quantity to solve for and returns: Set exactly one value to 0 to solve for it.
Does setting temperature to 0 mean the gas is at absolute zero?+
No. In this calculator, entering 0 selects temperature as the unknown. The tool then calculates T = PV/(nR) from the supplied pressure, volume, and moles.
Can I enter Celsius or gauge pressure directly?+
No. Convert Celsius to kelvin using T(K) = T(°C) + 273.15. Convert gauge pressure to absolute pressure by adding the relevant ambient pressure, then express that absolute pressure in atmospheres.
Can the calculator solve for both volume and moles at once?+
No. Setting both to 0 triggers the exactly-one-zero error. PV = nRT requires three known quantities to determine the remaining one.
Does the calculator save my information?+
Calculations run in your browser. While signed in, inputs and results are automatically recorded in account history; saving a result creates a separate saved record.
Further reading
You might also like
Molarity Calculator
Calculate solution molarity from moles of solute and volume.
Moles from Mass
Convert grams of a substance to moles using its molar mass.
pH Calculator
Calculate pH from hydrogen ion concentration.
Dilution Calculator (C₁V₁ = C₂V₂)
Find the volume of stock solution needed for a target dilution.
Half-Life Calculator
Calculate the remaining amount of a substance after radioactive or chemical decay.
Percent Yield
Calculate the percent yield of a chemical reaction.
Results are estimates for informational purposes and are not financial, medical or legal advice.