Solve PV = nRT for any one of pressure, volume, moles or temperature — with full unit mixing,
convert between moles and mass via molar mass, and compute ideal-gas density
ρ = PM/RT. Everything runs in your browser; temperature is always converted to kelvin internally,
and anything at or below absolute zero is rejected with an honest error.
P·V = n·R·T
Convert between amount of substance and mass with n = m / M and m = n × M, where M is the molar mass in g/mol.
Ideal-gas density follows directly from PV = nRT: with n = m/M you get ρ = PM / RT — density grows with pressure and molar mass, and falls with temperature.
This is the dry ideal-gas approximation. For real humid air (water vapor is lighter than dry air, so humidity lowers density) use the dedicated air-density calculator, which applies the Sonntag + CIPM-2007 corrections.
The universal gas constant is one physical constant — R = kB·NA, exact since the 2019 SI redefinition (kB = 1.380649×10⁻²³ J/K and NA = 6.02214076×10²³ mol⁻¹ are both defined exactly). The values below are derived from it, not separate constants:
Unit system
How it is derived
Value
Molar volume at STP
STP definition
Conditions
Vm = RT/P
IUPAC (since 1982)
273.15 K, 100 kPa
22.7110 L/mol
Legacy / NIST
273.15 K, 101.325 kPa
22.4140 L/mol
Watch out: textbooks disagree on STP. Always check whether a problem means 100 kPa or 1 atm — the molar volume differs by about 1.3%.
How the equation rearranges
One equation, four unknowns — enter any three and the calculator solves the fourth:
P = nRT / V pressure from amount, temperature and volume
V = nRT / P volume from amount, temperature and pressure
n = PV / RT amount from pressure, volume and temperature
T = PV / nR absolute temperature from pressure, volume and amount
Kelvin is mandatory. The gas law only works with an absolute temperature scale — the calculator converts °C and °F to kelvin before touching the equation, and rejects anything at or below 0 K. See FAQ #2 for the classic trap this avoids.
Exact unit definitions used internally: 1 atm = 101,325 Pa = 14.6959 psi = 759.9999 mmHg (about 760); 1 bar = 100,000 Pa; 1 psi = 6,894.757293168 Pa; 1 ft³ = 0.028316846592 m³. You may mix units freely — everything converts to SI first.
Worked examples
Example 1 — volume at legacy STP
1 mol of gas at 273.15 K and 101,325 Pa. V = nRT/P = (1 × 8.314462618 × 273.15) / 101325 = 2271.0955 / 101325 = 0.02241397 m³ = 22.4140 L.
Example 2 — pressure from moles, volume and temperature
1.50 mol of gas in a 5.00 L vessel at 298.15 K (25 °C). P = nRT/V = (1.5 × 0.082057366 × 298.15) / 5.00 = 36.6981 / 5.00 = 7.3396 atm = 743.69 kPa.
Example 3 — moles from mass
50.0 g of nitrogen gas (M = 28.014 g/mol). n = m/M = 50.0 / 28.014 = 1.78482 mol.
Example 4 — density of dry air at STP
Dry air, M = 28.9647 g/mol, at 273.15 K and 101,325 Pa. ρ = PM/RT = (101325 × 0.0289647) / (8.314462618 × 273.15) = 1.2923 kg/m³ = 1.2923 g/L = 0.080673 lb/ft³.
Scope boundary — which gas tool do you need?
This tool (single state): relate P, V, n and T of one gas sample with PV = nRT. The amount of gas may change or be solved for.
Two-state problems (same gas, before → after): Boyle's law (P₁V₁ = P₂V₂, constant T), Charles's law (V₁/T₁ = V₂/T₂, constant P), Gay-Lussac's law (P₁/T₁ = P₂/T₂, constant V).
Humid real air: for humid real air use the air-density calculator (Sonntag + CIPM-2007 corrections) — this page's density mode is the dry ideal-gas approximation ρ = PM/RT.
Deep density workflows (many gases, ratios vs. air): see the dedicated gas-density calculator.
Frequently asked questions
What is the ideal gas law?
The ideal gas law is PV = nRT. P is the absolute pressure, V the volume, n the amount of gas in moles, T the absolute temperature in kelvin, and R the universal gas constant, 8.314462618 J/(mol·K). It is the combination of Boyle's, Charles's and Gay-Lussac's laws into one equation that relates all four quantities of a single gas sample at once.
Why must the temperature be in kelvin?
This is the classic trap: the law only works with an absolute temperature scale. Heating a gas from 20 °C to 80 °C is not a fourfold increase — in kelvin that is 293.15 K to 353.15 K, a factor of only 1.2047, so the pressure (or volume) grows by about 20.5%, not 300%. Plugging °C straight into PV = nRT gives nonsense, including negative volumes. This calculator converts °C and °F to kelvin for you before touching the equation.
How do you solve the ideal gas law for volume?
Rearrange to V = nRT / P. Example: 2 mol of gas at 300 K and 150 kPa. V = (2 × 8.314462618 × 300) / 150000 = 4988.6776 / 150000 = 0.0332579 m³ = 33.2579 L. Enter any three of P, V, n, T in the solver above and it computes the fourth, showing the answer in every supported unit.
How do you solve the ideal gas law for pressure?
Rearrange to P = nRT / V. Example: 1.50 mol of gas in a 5.00 L vessel at 298.15 K (25 °C). P = (1.5 × 0.082057366 × 298.15) / 5.00 = 36.6981 / 5.00 = 7.3396 atm = 743.69 kPa. Note the R value 0.082057366 L·atm/(mol·K) is derived from the SI constant, not a separate constant — see the R & constants tab.
How do you convert between moles and mass?
With the molar mass M: n = m / M and m = n × M. Example: 50.0 g of nitrogen gas (M = 28.014 g/mol) is n = 50.0 / 28.014 = 1.78482 mol. The Moles ↔ mass tab has presets for common gases (H₂, He, CH₄, N₂, dry air, O₂, Ar, CO₂) or enter any custom molar mass.
How is gas density derived from the ideal gas law?
Substitute n = m/M into PV = nRT: PV = (m/M)RT, and since density ρ = m/V, you get ρ = PM / RT. Density rises with pressure and molar mass and falls with temperature. Example: dry air (M = 28.9647 g/mol) at 273.15 K and 101,325 Pa gives ρ = (101325 × 0.0289647) / (8.314462618 × 273.15) = 1.2923 kg/m³ = 1.2923 g/L = 0.080673 lb/ft³.
Which value of the gas constant R should I use?
There is only one R: 8.31446261815324 J/(mol·K), exact since the 2019 SI redefinition (R = kB × NA, both defined exactly). Every other form is derived from it by unit conversion: 8.314462618 kPa·L/(mol·K) because 1 kPa·L = 1 J exactly; 0.082057366 L·atm/(mol·K); 62.36359 L·mmHg/(mol·K). This calculator works in SI internally, so you can mix any input units freely — you never need to pick an R yourself.
What is the molar volume of a gas at STP?
It depends on which STP you mean — textbooks disagree. IUPAC STP (since 1982): 273.15 K and 100 kPa → Vm = RT/P = 22.7110 L/mol. Legacy/NIST STP: 273.15 K and 101.325 kPa (1 atm) → 22.4140 L/mol, the familiar textbook number. Always check whether a problem means 100 kPa or 1 atm; the two differ by about 1.3%.
When does the ideal gas law stop being accurate?
At high pressure or low temperature, where molecules are crowded enough that their own volume and intermolecular attractions matter — for example CO₂ near its condensation point, or hydrogen stored at hundreds of bar. The deviation is measured by the compressibility factor Z = PV/nRT: Z = 1 for an ideal gas, and real gases drift away from 1 at extremes. For those regimes engineers use corrections such as the van der Waals equation. At ordinary room conditions for common gases, PV = nRT is typically accurate within a percent or two.
How is this different from Boyle's, Charles's and Gay-Lussac's laws?
Those three laws are two-state laws: they compare the same gas before and after a change while holding one variable fixed — Boyle's law (P₁V₁ = P₂V₂, constant T), Charles's law (V₁/T₁ = V₂/T₂, constant P), Gay-Lussac's law (P₁/T₁ = P₂/T₂, constant V). This calculator is single-state: it relates P, V, n and T of one gas sample with PV = nRT, and the amount of gas may change or be solved for. For humidity-corrected real air density, use the dedicated air-density tool instead of this page's dry ideal-gas approximation.
We use cookies and third-party services (including Google AdSense) to personalize content, analyze traffic, and serve relevant ads. By clicking "Accept", you consent to our use of cookies as described in our Privacy Policy.
Report an issue
2 taps, no typing needed — diagnostics are sent automatically.