Density from temperature and pressure can be calculated for a gas if you also know its molar mass; for an ideal gas, density equals pressure × molar mass ÷ (gas constant × absolute temperature). Enter the pressure, temperature, and molar mass below to estimate the gas density, with the result in kg/m³ and a corresponding value in g/L.
Formula
The ideal-gas density equation is:
ρ = PM / (RT)
- ρ is gas density in kg/m³.
- P is absolute pressure in pascals (Pa). The calculator accepts kPa and converts it to Pa by multiplying by 1,000.
- M is molar mass in kg/mol. The calculator accepts g/mol and converts it to kg/mol by dividing by 1,000.
- R is the molar gas constant, exactly 8.31446261815324 J/(mol·K).
- T is absolute temperature in kelvins (K), calculated from degrees Celsius as °C + 273.15.
The second output uses the fact that 1 kg/m³ equals 1 g/L, so its numerical value is the same. The first output is the requested density in SI units.
Worked Example
Using the defaults—pressure 101.325 kPa, temperature 25 °C, and molar mass 28.97 g/mol—convert the inputs first:
- Pressure: 101.325 kPa × 1,000 = 101,325 Pa.
- Molar mass: 28.97 g/mol ÷ 1,000 = 0.02897 kg/mol.
- Temperature: 25 + 273.15 = 298.15 K.
Substitute into the equation:
ρ = (101,325 × 0.02897) ÷ (8.31446261815324 × 298.15)
ρ = 2,935.35525 ÷ 2,478.95703 ≈ 1.1841 kg/m³
Rounded to the calculator’s three decimal places, the density is 1.184 kg/m³, or 1.184 g/L.
Assumptions
- The gas follows the ideal-gas equation at the entered conditions.
- Pressure is absolute pressure, not gauge pressure.
- Temperature is converted to kelvins; it must be above absolute zero.
- Molar mass describes the gas mixture or pure gas being evaluated. The default, 28.97 g/mol, is a conventional approximate molar mass for dry air, not a universal value for gases.
When This Calculation Is Useful
This estimate is useful for comparing gas density at different temperatures or pressures, checking basic gas-law calculations, and converting a gas volume into an approximate mass when the composition is known. It also helps explain why a gas in a sealed container can become denser when cooled: at fixed pressure, lower absolute temperature means greater density under the ideal-gas model.
The molar mass matters just as much as temperature and pressure. At identical conditions, a gas with a higher molar mass is denser. For a mixture, use its average molar mass based on composition; using the molar mass of just one component can produce a misleading answer. If composition changes, calculate a new mixture molar mass before relying on the density estimate.
Pressure, Temperature, and the Ideal-Gas Model
At a fixed temperature and composition, ideal-gas density is directly proportional to absolute pressure: doubling the pressure doubles the calculated density. At fixed pressure and composition, density is inversely proportional to absolute temperature. These relationships apply to kelvins, not directly to Celsius values. For example, 20 °C is about 293.15 K; it is not a meaningful denominator to substitute as 20 in the equation.
Real gases do not always behave ideally. The approximation is generally most dependable when gas pressure is not too high and the gas is not close to condensation. At high pressures or near a phase change, intermolecular effects can make the actual density differ. A real-gas calculation typically uses a compressibility factor, Z:
ρ = PM / (ZRT)
Here Z is dimensionless: the ideal-gas equation assumes Z = 1. For a more accurate real-gas estimate, Z must be determined for the particular gas mixture and conditions, commonly from suitable reference data or an equation of state. It cannot be inferred from temperature and pressure alone without information about the gas.
Common Input and Interpretation Mistakes
- Using gauge pressure: The equation needs absolute pressure. Convert gauge pressure by adding the local atmospheric pressure; for example, gauge pressure alone is not the pressure in the gas-law equation.
- Mixing units: The formula pairs Pa, kg/mol, and K with the stated SI value of R. The calculator performs the kPa, g/mol, and Celsius conversions explicitly.
- Ignoring gas identity: Temperature and pressure do not uniquely determine density. Molar mass, or equivalent composition information, is required.
- Confusing density and mass: Density is mass per volume. To estimate mass, multiply density by the gas volume expressed in compatible units.
- Over-reading rounded results: Three decimal places are a display choice, not a guarantee of accuracy. Uncertainty in pressure, temperature, composition, and non-ideal behavior may be larger than the rounding difference.
For gases near ordinary atmospheric conditions, 1 kg/m³ and 1 g/L are numerically identical. This equivalence is convenient but does not mean all density units are interchangeable without conversion; for example, kg/L is 1,000 times larger numerically than kg/m³ for the same density.
Frequently Asked Questions
Can I calculate density from temperature and pressure alone?
No. You also need the gas’s molar mass or its composition so the mixture’s average molar mass can be determined. The ideal-gas equation then provides an estimate.
Should I enter absolute or gauge pressure?
Enter absolute pressure. If your reading is gauge pressure, add the atmospheric pressure applicable to the location and measurement before using the calculator.
Why does the calculator ask for Celsius but use kelvins?
The gas-law equation requires absolute temperature. The calculator accepts Celsius for convenience and adds 273.15 to convert to kelvins.
Is the result accurate for every gas?
It is an ideal-gas estimate. Real-gas deviations can matter at high pressure, low temperature, or near condensation; accurate work may require a compressibility factor or a real-gas equation of state.
What molar mass should I use for air?
For ordinary dry air, about 28.97 g/mol is a common approximate value. Humidity and changes in composition affect the mixture’s average molar mass, so use a value appropriate to the gas being considered.
Does higher temperature always mean lower density?
Not in every situation. At fixed pressure and composition, the ideal-gas equation predicts lower density as temperature rises. In a rigid sealed container, volume and amount of gas are fixed, so density stays constant as pressure changes with temperature.
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 | kg/m³ | (p * 1000) * (mm / 1000) / (8.31446261815324 * (t + 273.15)) | 3 out gl | 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
- Pressure Density Depth Formula for Fluids98,066 Pa
- Pressure Density Temperature Equation Calculator100,961.74 Pa
- Pressure Density Cup: What It Measures and How It Works1.0000 g/mL
- Pressure, Density, and Temperature: How They Relate101,307 Pa
- Pressure-Based vs Density-Based Solvers in CFD
- Pressure-Based vs Density-Based Solvers in CFD