Gas Density Calculator — Ideal Gas Law ρ = PM/RT
Find the density of any gas at any temperature and pressure. Select a common gas or enter a custom molar mass, set your conditions, and get the density in g/L and kg/m³ instantly.
Gas
°C
atm
At the entered temperature and pressure. 1 g/L = 1 kg/m³.
- 1
Temperature in Kelvin
T = 25 + 273.15 = 298.15 - 2
Denominator R × T
0.08206 × 298.15 = 24.4662 - 3
Gas density ρ = P × M ÷ (R × T)
1 × 28.97 ÷ 24.4662 = 1.1841
How does this calculator work?
Gas density ρ (g/L) = P (atm) × M (g/mol) ÷ (0.08206 × T (K)) from the ideal gas law. At STP (0 °C, 1 atm) density = M ÷ 22.41 g/L. Heavier molar mass, higher pressure, or lower temperature each increase density. The formula assumes ideal-gas behaviour, which holds well at moderate conditions.
Formula
How this is calculated
The ideal gas law PV = nRT relates the pressure, volume, amount and temperature of a gas. Rearranging for density: dividing both sides by V and multiplying by molar mass M gives ρ = (n/V)·M = PM/(RT). Because R is a universal constant, density increases with higher pressure (more gas squeezed in) or larger molar mass (heavier molecules), and decreases with higher temperature (molecules spread out more).
The calculator converts the Celsius temperature to Kelvin (T = °C + 273.15) and uses R = 0.08206 L·atm/(mol·K). The result in g/L is numerically identical to kg/m³ — a convenient coincidence that follows from unit analysis. At standard temperature and pressure (STP: 0 °C, 1 atm) any ideal gas occupies 22.41 L/mol, so density at STP simplifies to M/22.41 g/L.
The ideal gas approximation is accurate for most common gases at moderate conditions. It becomes less reliable at very high pressures (above ~10 atm) or temperatures close to the condensation point, where intermolecular forces and molecular volume become significant. Real-gas corrections (van der Waals equation, compressibility factor Z) are needed for those conditions.
Frequently asked questions
Using M = 28.97 g/mol for dry air and T = 298.15 K: ρ = (1 × 28.97)/(0.08206 × 298.15) ≈ 1.184 g/L (1.184 kg/m³). At STP (0 °C, 1 atm) it is slightly higher at ≈ 1.293 g/L.
Higher temperature gives gas molecules more kinetic energy, so they move faster and occupy more volume. The same mass spreads into a larger space, reducing the mass per unit volume (density). This is why hot air is lighter than cool air and rises inside a hot-air balloon.
The ideal gas law fails when intermolecular attractions are strong or molecular volume is non-negligible — at very high pressures (above ~10 atm), near the condensation point, or for polar gases like water vapour at high humidity. Under those conditions use real-gas equations such as van der Waals with tabulated a and b constants for the specific gas.
Also known as
TG we-Calculate Editorial Team. (2026). Gas Density Calculator — Ideal Gas Law ρ = PM/RT [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/gas-density-calculator
TG we-Calculate Editorial Team. "Gas Density Calculator — Ideal Gas Law ρ = PM/RT." TG we-Calculate. 2026. https://we-calculate.com/calculator/gas-density-calculator.
TG we-Calculate Editorial Team, "Gas Density Calculator — Ideal Gas Law ρ = PM/RT," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/gas-density-calculator
@misc{wecalculate_gas_density_calculator, title = {Gas Density Calculator — Ideal Gas Law ρ = PM/RT}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/gas-density-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
