molecalculator

Moles & Molar Mass

Gas Density Calculator: Formula and Examples

Calculator No. 01-1702 · Updated · Formula and assumptions shown below

Gas density 1.250 kg/m³
Gas density
1.250 g/L
= Gas density
Molar mass
28.0134 g/mol
Set in the form below
Absolute pressure
101.325 kPa
Set in the form below
You enter
Molar mass (g/mol), Absolute pressure (kPa), Temperature (°C)
You get
Gas density (kg/m³), Gas density (g/L)
Rounding
3 dp

For study and lab planning. The result follows from the numbers you enter and the formula shown. Check it against your method before you weigh, mix or dilute anything, follow the safety data sheet and your supervisor, and do not use it for clinical, dosing or medication work.

Gas density is the mass of a gas per unit volume, usually reported in kilograms per cubic metre (kg/m³) or grams per litre (g/L). This calculator estimates the density from a gas’s molar mass, pressure, and temperature using the ideal-gas equation; enter those three values to get density in kg/m³ and g/L.

Formula

For an ideal gas, density is pressure multiplied by molar mass, divided by the universal gas constant multiplied by absolute temperature:

ρ = PM / RT

  • ρ is gas density in kg/m³.
  • P is absolute pressure in pascals (Pa). The calculator converts the input pressure from kPa to Pa by multiplying by 1,000.
  • M is molar mass in kg/mol. The input is in g/mol, so the calculator divides it by 1,000.
  • R is the molar gas constant, exactly 8.31446261815324 J/(mol·K).
  • T is absolute temperature in kelvins (K). Convert Celsius to kelvins by adding 273.15.

The second output gives the same density in g/L. These units have the same numerical value because 1 kg/m³ equals 1 g/L. Pressure must be absolute pressure—not gauge pressure relative to the atmosphere.

Worked Example

Use the calculator’s defaults: nitrogen molar mass 28.0134 g/mol, pressure 101.325 kPa, and temperature 0 °C. The nitrogen molar mass is a conventional value based on the usual natural isotopic composition.

  1. Convert pressure: 101.325 kPa × 1,000 = 101,325 Pa.
  2. Convert molar mass: 28.0134 g/mol ÷ 1,000 = 0.0280134 kg/mol.
  3. Convert temperature: 0 °C + 273.15 = 273.15 K.
  4. Substitute into the equation: ρ = (101,325 Pa × 0.0280134 kg/mol) ÷ (8.31446261815324 J/(mol·K) × 273.15 K).
  5. Calculate: ρ ≈ 1.249 kg/m³, which is also 1.249 g/L when rounded to three decimal places.

Assumptions

  • The gas behaves ideally, so molecular volume and intermolecular attractions are neglected.
  • The stated pressure is absolute pressure.
  • The stated temperature is uniform and converted from Celsius to kelvins.
  • Molar mass represents the gas’s composition; mixtures require an appropriate average molar mass.

What Gas Density Means

Density describes how much gas mass occupies a given volume. Unlike the density of a solid under ordinary conditions, gas density changes substantially when pressure or temperature changes. Compressing a gas into a smaller volume raises its density; heating it at constant pressure generally lowers its density because the gas expands.

For example, the calculator’s nitrogen result is about 1.249 kg/m³ at 0 °C and 101.325 kPa. At the same pressure but 20 °C, the ideal-gas estimate is lower, about 1.165 kg/m³. The gas’s identity has not changed; the temperature has. At constant temperature, increasing absolute pressure increases ideal-gas density in direct proportion.

Density is not the same thing as molar mass. Molar mass describes the mass of one mole of a substance, while density also depends on the conditions and the volume occupied. A gas with a larger molar mass will generally be denser than a lighter gas at the same temperature and pressure, but the comparison only holds when those conditions are alike.

How the Ideal-Gas Calculation Works

The ideal-gas law is PV = nRT, where V is volume and n is amount of gas in moles. Density is mass divided by volume. Since the mass m equals nM, rearranging the gas law gives ρ = m/V = PM/RT. This form lets you calculate density without entering a sample’s volume or amount.

The calculation is useful for approximate conversions between gas mass and volume, comparing gases at specified conditions, and basic chemistry or engineering estimates. It is also a way to see why a density value must be accompanied by temperature and pressure. A statement such as “nitrogen has a density of 1.25 kg/m³” is incomplete unless the reference conditions are stated.

At low pressures and temperatures far above condensation, many gases are close enough to ideal for routine estimates. Real gases can depart from this model, especially at high pressure or near a boiling or critical point. In those cases, use an appropriate real-gas equation or measured density data for the specific substance and conditions.

Inputs, Units, and Common Errors

  • Use absolute pressure. A gauge reading of zero does not mean zero absolute pressure; it usually means pressure is near the surrounding atmosphere. For gauge pressure, add the local atmospheric pressure before entering the value.
  • Enter temperature in the stated unit. This calculator accepts °C and converts it to K. Do not enter a Celsius value as though it were kelvins. The formula requires a temperature scale whose zero is absolute zero.
  • Check the molar mass. Pure gases use the molar mass of their molecular formula: for example, nitrogen gas is N₂, not N. For a mixture, use its composition-weighted mean molar mass.
  • Keep units consistent. The calculator converts kPa to Pa and g/mol to kg/mol internally. If doing the calculation by hand, make the same conversions or use a consistently converted form of R.
  • Do not overstate precision. Output digits reflect the calculation, not necessarily the accuracy of the input conditions, gas composition, or ideal-gas approximation.

Comparing Gas Densities

To compare two gases fairly, calculate or measure them at the same absolute pressure and temperature. Under ideal conditions, the density ratio is the same as the ratio of their molar masses: ρ₁/ρ₂ = M₁/M₂. Thus, at equal conditions, a gas with twice the molar mass has twice the ideal-gas density.

Comparisons with air are often useful, but “lighter than air” does not mean that a gas will always rise or remain in a particular place. Mixing, temperature gradients, ventilation, obstacles, and the release conditions affect how gases move. Density alone is not a complete safety assessment; consult relevant safety information and follow applicable workplace procedures.

Frequently Asked Questions

What is the density of a gas?
It is the mass of gas per unit volume. Common units are kg/m³ and g/L; the value depends on the gas’s composition, temperature, and pressure.

How do you calculate gas density?
For an ideal gas, use ρ = PM/RT. Convert pressure to absolute pressure, molar mass to units compatible with R, and temperature to kelvins.

Does gas density increase with pressure?
At constant temperature, ideal-gas density increases in direct proportion to absolute pressure. Real-gas behavior can differ at high pressures.

Does heating a gas make it less dense?
At constant pressure, heating an ideal gas lowers its density because its volume expands. If the gas is held in a fixed volume instead, its pressure rises and its density does not change simply because of heating.

Is gas density the same in g/L and kg/m³?
Yes, the numerical values are equal: 1 g/L = 1 kg/m³. This is a convenient conversion between commonly used units.

Can this formula calculate the density of any gas accurately?
It gives an ideal-gas estimate. For dense gases, conditions near condensation, or applications needing high accuracy, use real-gas data or a suitable equation of state.

Related

Formula used
in mm | Molar mass | g/mol | 28.0134 | 0
in p | Absolute pressure | kPa | 101.325 | 0
in t | Temperature | °C | 0 | -273.15
out d | Gas density | kg/m³ | (p * 1000) * (mm / 1000) / (8.31446261815324 * (t + 273.15)) | 3
out dg | Gas density | g/L | d | 3

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation with the constants and conversion factors written on the page, rounded as each result states. See method and constants, the disclaimer or report an error.

More in this section

The whole Moles & Molar Mass section →