Thermodynamics

Ideal Gas Law Calculator — Solve PV = nRT for Pressure, Volume, Amount of Substance or Temperature

Solve one missing ideal-gas state variable from the other three, then calculate molar volume and molar density; add molar mass to obtain gas mass and density.

Unit-aware inputs Deterministic calculation Engineering interpretation
Calculation workspace

Enter the known values and review the calculated result

Deterministic calculation
01
Parameters

Input parameters

Use consistent values and select the intended engineering units.

Ideal Gas State Variables

Optional Gas Property

02
Output

Results

Live
Ready to calculate Complete the required inputs and run the calculation.
—
Calculation tools Save, export and manage your results

Save your calculation, export available results, or store a finalized engineering artifact in your account.

Engineering reference

Method, application and limitations

Review the calculation method, intended application and engineering assumptions before using the result in a design decision.

01
Method

Formula and calculation method

Ideal Gas Law — PV = nRT

The calculator solves the ideal gas equation for exactly one missing state variable:

P · V = n · R · T

where:

  • P — absolute pressure [Pa]
  • V — gas volume [m³]
  • n — amount of substance [mol]
  • T — absolute temperature [K]
  • R — universal molar gas constant = 8.31446261815324 J/(mol·K)

Rearranged ideal gas equations

When pressure is unknown:

P = nRT / V

When volume is unknown:

V = nRT / P

When amount of substance is unknown:

n = PV / (RT)

When temperature is unknown:

T = PV / (nR)

Secondary gas properties

After the complete P–V–n–T state has been determined, the calculator also evaluates molar volume:

Vm = V / n

where Vm is the molar volume [m³/mol].

Molar density is calculated as:

ρmol = n / V

where ρmol is the molar density [mol/m³].

Mass and gas density from molar mass

If the optional molar mass M is provided, gas mass is calculated from:

m = nM

and gas density is then:

ρ = m / V

where:

  • M — molar mass [kg/mol in the calculation basis]
  • m — gas mass [kg]
  • ρ — gas density [kg/m³]

Exactly one of P, V, n or T must be left unknown. All supplied state variables must be finite and greater than zero. Molar mass is optional, but must also be greater than zero when provided.

02
Application

When to use this calculator

When to use this calculator

Use this ideal gas law calculator when three of the four state variables in PV = nRT are known and you need to determine the fourth.

It can be used to:

  • calculate absolute gas pressure from volume, amount of substance and temperature,
  • calculate gas volume from pressure, amount of substance and temperature,
  • calculate amount of substance from pressure, volume and temperature,
  • calculate absolute temperature from pressure, volume and amount of substance,
  • calculate molar volume for the completed ideal-gas state,
  • calculate molar density from amount of substance and volume,
  • calculate gas mass when molar mass is supplied,
  • calculate ideal-gas density when molar mass is supplied.

The calculator is useful for thermodynamic state calculations, preliminary gas-system calculations, laboratory calculations and engineering estimates where the ideal-gas model is appropriate.

When this calculator is not the correct tool

This calculator represents a single ideal-gas state. It is not a combined gas law calculator for comparing two separate states, and it does not calculate a gas-specific molar mass from chemical composition.

It also does not apply a compressibility factor, determine real-gas properties, solve a real-gas equation of state, evaluate phase equilibrium, condensation, pressure drop, heat transfer or transient gas-system behavior.

If non-ideal gas behavior is significant for the application, a real-gas property calculation or another appropriate equation-of-state method should be used instead of relying on the ideal-gas result alone.

03
Decision support

How to interpret the result

How to interpret the results

The primary result is the one missing state variable required to complete the entered ideal-gas state according to PV = nRT.

Calculated pressure P

If pressure is the missing variable, the result is the absolute pressure required for the entered volume, amount of substance and temperature. With the other variables fixed, calculated pressure increases with increasing n or T and decreases with increasing V.

Calculated volume V

If volume is the missing variable, the result is the volume required for the entered pressure, amount of substance and temperature. With the other variables fixed, calculated volume increases with increasing n or T and decreases with increasing P.

Calculated amount of substance n

If n is the missing variable, the result is the amount of substance required for the entered pressure, volume and temperature. With the other variables fixed, calculated n increases with pressure or volume and decreases with increasing temperature.

Calculated temperature T

If temperature is the missing variable, the result is the absolute temperature required for the entered pressure, volume and amount of substance. With the other variables fixed, calculated temperature increases with pressure or volume and decreases with increasing n.

Molar volume Vm

Molar volume is the total gas volume divided by the amount of substance. A larger Vm means that each mole occupies more volume in the calculated ideal-gas state.

Molar density ρmol

Molar density is the amount of substance per unit volume. It is the reciprocal relationship to molar volume for the same state: a higher molar density corresponds to a lower molar volume.

Gas mass m

Gas mass is returned only when molar mass is supplied. It is calculated as the amount of substance multiplied by the entered molar mass.

Gas density ρ

Mass density is also returned only when molar mass is supplied. It represents the calculated gas mass per unit volume for the completed ideal-gas state.

Invalid result

The calculation is invalid if exactly one of P, V, n or T is not left unknown, if a required state variable is non-finite or not greater than zero, or if an entered molar mass is not finite and greater than zero.

A successfully calculated state only confirms consistency with the ideal gas equation implemented by this calculator. It does not confirm that the actual gas behaves ideally under the evaluated operating conditions.

04
Worked case

Calculation example

Example — Calculate amount of substance and gas density

A gas occupies a volume of 1.000 m³ at an absolute pressure of 101325 Pa and an absolute temperature of 293.15 K. Determine the amount of substance using the ideal gas law. Assume an optional molar mass of 0.02897 kg/mol to also calculate gas mass and density.

Input data

  • P = 101325 Pa
  • V = 1.000 m³
  • T = 293.15 K
  • n = unknown
  • M = 0.02897 kg/mol
  • R = 8.31446261815324 J/(mol·K)

Step 1 — Solve PV = nRT for n

n = PV / (RT)

n = (101325 × 1.000) / (8.31446261815324 × 293.15)

n = 41.5712 mol

Step 2 — Calculate molar volume

Vm = V / n

Vm = 1.000 / 41.5712 = 0.0240551 m³/mol

Step 3 — Calculate molar density

ρmol = n / V

ρmol = 41.5712 / 1.000 = 41.5712 mol/m³

Step 4 — Calculate gas mass

m = nM

m = 41.5712 × 0.02897 = 1.20432 kg

Step 5 — Calculate gas density

ρ = m / V

ρ = 1.20432 / 1.000 = 1.20432 kg/m³

Result

  • Amount of substance: 41.5712 mol
  • Molar volume: 0.0240551 m³/mol
  • Molar density: 41.5712 mol/m³
  • Gas mass: 1.20432 kg
  • Gas density: 1.20432 kg/m³

The calculation gives the state required by the ideal gas equation for the supplied pressure, volume and temperature. The mass-based results depend directly on the entered molar mass. They remain ideal-gas estimates and do not include a real-gas compressibility correction.

05
Model boundaries

Assumptions and limitations

Assumptions and limitations

  • The calculation uses the ideal gas equation P · V = n · R · T.
  • Exactly one of P, V, n or T must be unknown. The calculator does not solve an underdetermined state with two or more missing variables.
  • Pressure represents absolute pressure and must be finite and greater than zero when provided.
  • Volume must be finite and greater than zero when provided.
  • Amount of substance must be finite and greater than zero when provided.
  • Temperature represents absolute thermodynamic temperature and must be finite and greater than zero on the calculation basis.
  • The universal molar gas constant used by the calculation is R = 8.31446261815324 J/(mol·K).
  • Molar mass is optional. When entered, it must be finite and greater than zero.
  • The calculator does not determine molar mass, molecular weight or gas composition.
  • Mass and mass density are calculated only when molar mass is supplied.
  • The calculated density is based on the ideal-gas state and the entered molar mass.
  • The method does not include a compressibility factor Z or any other correction for non-ideal gas behavior.
  • The calculator does not implement a real-gas equation of state or determine real-gas properties from critical properties or composition.
  • The model represents one gas state and does not calculate a transition between separate initial and final states.
  • Phase change, condensation, evaporation, two-phase equilibrium and saturation limits are outside the implemented calculation.
  • Pressure drop, heat transfer, chemical reactions and transient storage behavior are not calculated.
  • No uncertainty or measurement-error propagation is included. Uncertainty in the entered state variables or molar mass is not quantified by the result.
  • The suitability of the ideal-gas approximation for the actual gas and operating conditions must be assessed separately when the result is used for engineering decisions.
06
Questions

Frequently asked questions

What does an ideal gas law calculator calculate?
An ideal gas law calculator uses PV = nRT to determine one missing state variable when the other three are known. This calculator can solve for absolute pressure P, volume V, amount of substance n or absolute temperature T. It also calculates molar volume and molar density, and can calculate gas mass and density when molar mass is provided.
What is the value of R in PV = nRT?
This calculator uses the universal molar gas constant R = 8.31446261815324 J/(mol·K). The state variables are evaluated on a consistent SI calculation basis, with pressure as absolute pressure and temperature as absolute thermodynamic temperature.
Why must pressure be absolute in the ideal gas equation?
The pressure P in PV = nRT is thermodynamic absolute pressure. A gauge-pressure value cannot be inserted directly as though it were absolute pressure because the equation relates the gas state to pressure measured from an absolute vacuum reference.
Why is absolute temperature used in the ideal gas law?
The temperature T in PV = nRT must represent absolute thermodynamic temperature. In the calculator's equation basis, temperature is expressed in kelvin and must be greater than 0 K. Using a non-absolute temperature value directly in the equation would give an incorrect gas-state result.
How is molar volume calculated from the ideal gas state?
Molar volume is calculated as Vm = V/n, where V is the gas volume and n is the amount of substance. The result is expressed in m³/mol and represents the volume occupied per mole for the calculated ideal-gas state.
Can this ideal gas calculator calculate gas density?
Yes, when molar mass is provided. The calculator first determines the complete P–V–n–T state, calculates gas mass from m = nM, and then calculates density from ρ = m/V. Without molar mass, it still calculates molar density n/V but does not return mass-based gas density.
Does this calculator determine molar mass or molecular weight?
No. Molar mass is an optional input, not a solved variable. The calculator does not determine chemical composition, molecular weight or molar mass from a chemical formula. When a valid molar mass is supplied, it is used only to calculate gas mass and mass density.
Is the ideal gas law calculator the same as a combined gas law calculator?
No. This calculator solves one thermodynamic state using P, V, n and T in the ideal gas equation. A combined gas law calculation normally compares two gas states for a fixed amount of gas. This tool does not accept separate initial and final P–V–T states.
Can I enter values for all four variables P, V, n and T?
No. Exactly one of P, V, n or T must be left empty. The calculator uses the other three values to solve the missing variable. If none or more than one of these four variables is missing, the calculation is treated as invalid.
Does PV = nRT account for real-gas behavior?
No. This calculator implements the ideal gas equation only. It does not use a compressibility factor Z or another real-gas equation of state. When real-gas effects are important, the ideal-gas result should be checked using an appropriate real-gas property model or calculation.
Add an engineering note