Calculate Density Using Ideal Gas Law | Gas Density Calculator


Calculate Density Using Ideal Gas Law

Determine the density of any gas based on pressure, temperature, and molar mass using the universal gas law formula.


Standard atmospheric pressure is 1 atm or 101.325 kPa.
Please enter a valid pressure.


Standard temperature is often 0°C or 25°C.
Temperature below absolute zero is not possible.


Dry air is approx 28.97 g/mol. Oxygen (O₂) is 32.00 g/mol.
Molar mass must be greater than zero.

Calculated Gas Density (ρ)

1.185 g/L

Absolute Temperature:
298.15 K
Pressure in atm:
1.000 atm
Formula Used:
ρ = (P × M) / (R × T)

Density vs. Temperature Trend (at Constant Pressure)

Visualization showing how density decreases as temperature rises.

What is calculate density using ideal gas law?

To calculate density using ideal gas law is a fundamental procedure in thermodynamics and fluid mechanics. While the basic Ideal Gas Law is usually written as PV = nRT, it can be mathematically rearranged to relate the density of a gas directly to its pressure, temperature, and molar mass. This method is incredibly useful because it allows scientists and engineers to determine the mass per unit volume of a gas without needing to measure the volume and mass separately.

Anyone working in fields like aerospace engineering, meteorology, or chemical processing needs to calculate density using ideal gas law to predict how gases will behave under varying environmental conditions. A common misconception is that gas density is constant; however, unlike liquids, gases are highly compressible, meaning their density changes significantly with even minor fluctuations in heat or pressure.

calculate density using ideal gas law Formula and Mathematical Explanation

The derivation starts with the standard Ideal Gas Law equation: PV = nRT.

  • First, we recognize that moles (n) equals mass (m) divided by molar mass (M): n = m / M.
  • Substituting this into the law gives: PV = (m/M)RT.
  • Rearranging to isolate mass over volume (which is density, ρ): m / V = (P × M) / (R × T).
  • The final formula used to calculate density using ideal gas law is: ρ = (P · M) / (R · T).
Variables for Ideal Gas Law Density Calculation
Variable Meaning Standard Unit Typical Range
ρ (Rho) Gas Density g/L or kg/m³ 0.01 – 500
P Absolute Pressure atm or Pa 0 – 1000 atm
M Molar Mass g/mol 2 – 400 g/mol
R Gas Constant L·atm/(K·mol) 0.08206 (fixed)
T Absolute Temp Kelvin (K) 100 – 3000 K

Practical Examples (Real-World Use Cases)

Example 1: Oxygen in a Medical Tank

Suppose you need to calculate density using ideal gas law for pure oxygen (M = 32.00 g/mol) stored at a pressure of 10 atm and a temperature of 20°C.
First, convert temperature to Kelvin: 20 + 273.15 = 293.15 K.
Using R = 0.08206: ρ = (10 × 32.00) / (0.08206 × 293.15).
The density is approximately 13.30 g/L. This high density is why pressurized tanks can store significant mass in small volumes.

Example 2: Hot Air Balloon Lift

To understand lift, one must calculate density using ideal gas law for the hot air inside the balloon envelope. If the air inside is heated to 100°C (373.15 K) at 1 atm, and dry air has a molar mass of 28.97 g/mol:
ρ = (1 × 28.97) / (0.08206 × 373.15) ≈ 0.946 g/L.
Since ambient air at 20°C has a density of about 1.204 g/L, the density difference provides the buoyant force needed for flight.

How to Use This calculate density using ideal gas law Calculator

Our tool is designed for precision and ease of use. Follow these steps to calculate density using ideal gas law accurately:

  1. Enter Pressure: Input the absolute pressure and select the unit (atm, kPa, Pa, or psi). Ensure you are using absolute pressure, not gauge pressure.
  2. Enter Temperature: Input the temperature. The calculator automatically converts Celsius or Fahrenheit to Kelvin for the calculation.
  3. Select Molar Mass: Input the molar mass of the specific gas. We provide the default for air (28.97 g/mol).
  4. Review Results: The primary result shows the density in g/L. The intermediate values show the converted Kelvin temperature and atmospheric pressure for verification.
  5. Analyze Trends: View the generated SVG chart to see how the density would change if the temperature were to fluctuate while keeping pressure constant.

Key Factors That Affect calculate density using ideal gas law Results

  • Absolute Pressure: Gas density is directly proportional to pressure. Doubling the pressure (at constant temperature) doubles the density.
  • Thermodynamic Temperature: Density is inversely proportional to absolute temperature. As a gas heats up, its particles move faster and push further apart, decreasing density.
  • Molar Mass: Heavier gas molecules (like Xenon) will result in a much higher density than light molecules (like Hydrogen) under identical conditions.
  • The Gas Constant (R): While a constant, its value changes based on the units of pressure and volume used. Using 0.08206 is standard for atm and Liters.
  • Real Gas Deviations: The Ideal Gas Law assumes no intermolecular forces. At extremely high pressures or very low temperatures, real gases deviate from these calculations.
  • Elevation and Altitude: In meteorology, as altitude increases, pressure drops faster than temperature, leading to a net decrease in atmospheric density.

Frequently Asked Questions (FAQ)

1. Why do I need to use Kelvin to calculate density using ideal gas law?

The Kelvin scale is an absolute scale starting at absolute zero. Physical laws like the Ideal Gas Law are based on the kinetic energy of particles, which is directly proportional to absolute temperature. Using Celsius would result in incorrect ratios and potentially negative densities.

2. What is the difference between g/L and kg/m³?

They are numerically identical! 1 g/L is equal to 1 kg/m³. This is a convenient property of the metric system often used when we calculate density using ideal gas law.

3. Can I use this for liquids?

No. The Ideal Gas Law only applies to gases and vapors. Liquids have much stronger intermolecular forces and do not follow the P, V, T relationships defined by this law.

4. How does humidity affect air density calculations?

Water vapor is lighter than dry air (M ≈ 18 g/mol vs 29 g/mol). Therefore, humid air is actually less dense than dry air at the same temperature and pressure. To be precise, you would need to adjust the molar mass (M) based on the humidity ratio.

5. Is the density of air always 1.225 kg/m³?

No, that is the value at “Sea Level Standard” (15°C and 1 atm). If you calculate density using ideal gas law for a hot summer day at 35°C, the density drops to about 1.145 kg/m³.

6. What is the Gas Constant (R) value for kPa?

When pressure is in kPa and volume is in Liters, R is 8.3144 J/(mol·K) or L·kPa/(K·mol). Our calculator handles these unit conversions internally.

7. Does the type of gas matter?

Yes, significantly. The “identity” of the gas is captured by its Molar Mass (M). This is why CO₂ is denser than Oxygen, even at the same temperature and pressure.

8. When does the Ideal Gas Law fail?

It fails near the critical point of a gas—usually at very high pressures (where molecules are crowded) or very low temperatures (where molecules slow down enough for attractive forces to take over).


Leave a Reply

Your email address will not be published. Required fields are marked *