molecalculator

Moles & Molar Mass

Density from Pressure and Temperature: Gas Calculator

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

Gas density 1.1841 g/L
Gas density
1.1841 kg/m³
= Gas density
Absolute pressure
101.325 kPa
Set in the form below
Temperature
25 °C
Set in the form below
You enter
Absolute pressure (kPa), Temperature (°C), Molar mass (g/mol)
You get
Gas density (g/L), Gas density (kg/m³)
Rounding
4 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.

Calculate the density of a gas from its pressure, temperature, and molar mass using the ideal-gas equation. Enter pressure in kPa, temperature in °C, and molar mass in g/mol; the calculator returns density in g/L and kg/m³.

Formula

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

ρ = PM / (RT)

  • ρ is density. With the calculator’s units, the numerical result is in g/L.
  • P is absolute pressure in kPa.
  • M is molar mass in g/mol.
  • R is the gas constant, 8.31446261815324 kPa·L/(mol·K), numerically equivalent to J/(mol·K).
  • T is absolute temperature in kelvin, calculated from Celsius as T = t + 273.15.

The unit result follows from kPa·(g/mol) divided by kPa·L/(mol·K) times K, leaving g/L. Since 1 g/L equals 1 kg/m³, the two outputs have the same numerical value. Use absolute pressure, measured relative to a vacuum—not gauge pressure relative to the surrounding atmosphere.

Worked Example

Using the calculator’s defaults: P = 101.325 kPa, t = 25 °C, and M = 28.97 g/mol. First convert temperature: T = 25 + 273.15 = 298.15 K.

Then substitute into the density equation:

ρ = (101.325 × 28.97) / (8.31446261815324 × 298.15)

ρ = 2935.34025 / 2478.95703 ≈ 1.1841 g/L

Because 1 g/L equals 1 kg/m³, the second output is 1.1841 kg/m³. The molar mass of 28.97 g/mol is a representative approximate value for dry air, not a universal value for every gas or air mixture.

Assumptions

  • The gas behaves ideally, so intermolecular effects and molecular volume are neglected.
  • Pressure is absolute and entered in kPa; temperature is entered in °C and converted to K.
  • The supplied molar mass represents the gas mixture, if the sample is a mixture.

How Pressure and Temperature Affect Density

The equation comes from the ideal-gas law, PV = nRT. Density is mass divided by volume, and the number of moles n is mass divided by molar mass M. Substituting those relationships into the gas law and rearranging gives ρ = PM/(RT).

At a fixed temperature and for the same gas, increasing absolute pressure increases density in direct proportion. For example, doubling pressure while holding temperature constant doubles the ideal-gas density. At fixed pressure, raising the temperature lowers density because the gas occupies more volume; doubling absolute temperature halves the predicted density. These comparisons require kelvin, not Celsius: 20 °C is not twice as hot as 10 °C for gas-law calculations.

Molar mass matters too. At identical pressure and temperature, a gas with greater molar mass has greater ideal-gas density. This is why air’s density cannot be calculated from pressure and temperature alone unless its composition, or a suitable average molar mass, is known.

When This Calculation Is Useful

The ideal-gas estimate is useful for quick engineering, classroom, and laboratory calculations when pressure, temperature, and gas composition are known and conditions are not too far from ordinary ambient conditions. It can help compare gas samples, convert between a gas’s mass and volume under stated conditions, or check whether a reported value is plausible.

For a mixture, use its average molar mass. If the mixture is described by mole fractions yi, the ideal-mixture molar mass is Mmix = Σ(yiMi), where each yi is the fraction of the total moles contributed by component i and the fractions sum to 1. Do not use a mass fraction in this equation without converting it appropriately.

Pressure and temperature must describe the same gas sample and state. If a gas is humid, its composition includes water vapor; using the molar mass of dry air can introduce an error. For dry-air estimates, use a dry-air molar mass rather than treating it as a precise value for all atmospheric conditions.

Ideal Gas Versus Real Gas

Real gas molecules interact and occupy space. The ideal-gas approximation is often adequate at relatively low pressure and sufficiently high temperature, but its error can become important at high pressures, low temperatures, or near condensation. The direction and size of the error depend on the gas and conditions; there is no single correction factor that works for every substance.

For higher accuracy, use a real-gas equation of state or reliable property data for the specific gas at the specified pressure and temperature. One common way to express the correction is with the compressibility factor Z: ρ = PM/(ZRT). The ideal-gas result assumes Z = 1. A suitable Z value must come from a validated model or data for the substance and conditions; it should not be guessed. Near a phase boundary, first confirm whether the sample is actually a gas rather than a liquid or a two-phase mixture.

Common Input and Unit Mistakes

  • Using gauge pressure: Convert it to absolute pressure by adding the local atmospheric pressure. A gauge reading of zero does not mean zero absolute pressure.
  • Leaving temperature in Celsius: Add 273.15 to get kelvin. Substituting a Celsius number directly into RT gives an invalid result.
  • Mixing pressure units: This calculator requires kPa. If using another equation or tool, make sure the pressure unit matches the gas constant used.
  • Entering the wrong molar mass: Check the chemical formula and whether the gas is a pure substance or mixture. Molar mass must be in g/mol here.
  • Confusing density units: g/L and kg/m³ are numerically equal, whereas g/mL is 1,000 times larger than g/L.

Keep sensible precision in intermediate calculations, then round the final answer to match the precision of the input data. A result displayed to four decimal places is not necessarily accurate to four decimal places if pressure, temperature, or composition is only approximately known.

Frequently Asked Questions

Can I calculate gas density from pressure and temperature alone?
Not generally. You also need the gas’s molar mass or composition. Pressure and temperature determine density only when the gas identity or mixture is specified.

Does pressure mean absolute or gauge pressure?
Use absolute pressure. If your instrument reports gauge pressure, add the local atmospheric pressure before using the formula. The atmosphere is about 101.325 kPa at standard conditions, but actual local pressure can differ.

Why must temperature be in kelvin?
The ideal-gas law uses absolute temperature, whose zero corresponds to the lowest thermodynamic temperature. Convert °C to K by adding 273.15; Celsius values cannot be substituted directly.

Is 1 g/L the same as 1 kg/m³?
Yes. Converting grams to kilograms and liters to cubic meters changes both by a factor of 1,000, so the numerical values are equal.

Will this give the density of a liquid?
No. This calculator applies the ideal-gas equation. Liquids are not described accurately by this gas-law relationship; use substance-specific liquid density data or an appropriate liquid model.

When should I use a real-gas correction?
Consider one when pressure is high, temperature is low, or the gas is near condensation, and whenever the required accuracy is tighter than the ideal-gas approximation supports. Use a validated compressibility factor or property method for the particular gas and state.

Related

Formula used
in p | Absolute pressure | kPa | 101.325 | 0
in t | Temperature | °C | 25 | -273.15
in mm | Molar mass | g/mol | 28.97 | 0.001
out d | Gas density | g/L | p * mm / (8.31446261815324 * (t + 273.15)) | 4
out dk | Gas density | kg/m³ | d | 4

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 →