Density Formula for Pressure and Temperature
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
For an ideal gas, density from pressure and temperature is calculated with ρ = pM/(RT), where pressure and temperature determine the gas’s mass per unit volume when its molar mass is known. This calculator takes absolute pressure, absolute temperature, and molar mass, then returns density in kg/m³.
Formula
The ideal-gas density formula is:
ρ = pM / (RT)
- ρ is mass density, in kg/m³.
- p is absolute pressure, in pascals (Pa).
- M is molar mass, in kg/mol.
- R is the universal gas constant, 8.314462618 Pa·m³/(mol·K).
- T is absolute temperature, in kelvins (K).
The calculator accepts pressure in kPa and molar mass in g/mol, so its expression converts each to the SI units required: 1 kPa = 1,000 Pa and 1 g/mol = 0.001 kg/mol. Those conversion factors cancel numerically, giving the expression shown in the calculator block. The second output, molar density, is p/(RT) and describes moles per cubic metre rather than kilograms per cubic metre.
Worked Example
Using the calculator’s defaults—101.325 kPa, 273.15 K, and 28.97 g/mol—first convert pressure to 101,325 Pa and molar mass to 0.02897 kg/mol.
- Apply ρ = pM/(RT).
- Substitute: ρ = (101,325 Pa × 0.02897 kg/mol) / (8.314462618 Pa·m³/(mol·K) × 273.15 K).
- Evaluate and round to three decimal places: ρ = 1.292 kg/m³.
For comparison, molar density at these same inputs is p/(RT) = 44.615 mol/m³, rounded to three decimal places. The mass-density result depends on the gas’s molar mass; the molar-density result does not.
How Pressure and Temperature Affect Density
At fixed temperature and for the same gas, density is directly proportional to absolute pressure. Doubling the pressure doubles the predicted density. At fixed pressure, density is inversely proportional to absolute temperature: heating a gas makes its density lower if it can expand, while cooling it makes density higher.
These relationships follow from the ideal gas law, pV = nRT. Dividing the gas’s mass by its volume and using molar mass to relate mass to amount of substance leads to ρ = pM/(RT). The formula describes a gas’s density at specified conditions; it does not say that a sealed, rigid container loses mass when warmed. In that container, the volume and amount of gas stay fixed, so pressure rises with temperature instead.
Temperature must be on an absolute scale. Convert Celsius to kelvins with K = °C + 273.15, or Fahrenheit to kelvins with K = (°F + 459.67) × 5/9. Pressure must also be absolute: add local atmospheric pressure to a gauge-pressure reading. A gauge reading of zero means pressure is approximately atmospheric, not zero absolute pressure.
Choosing the Right Inputs and Units
Use the molar mass for the gas or mixture whose density you want. For a pure gas, this is its molecular or atomic molar mass; common approximate values include 28.97 g/mol for dry air, 32.00 g/mol for oxygen, and 44.01 g/mol for carbon dioxide. A gas mixture’s effective molar mass depends on its composition, so an assumed air value may not suit humid air or a process mixture.
- Use absolute pressure in kPa, bar, atmospheres, or Pa, then convert consistently. One bar is 100 kPa; one standard atmosphere is 101.325 kPa.
- Use kelvins for temperature in the formula, not Celsius or Fahrenheit directly.
- Keep molar mass and the gas constant in matching units. This calculator’s inputs are g/mol and kPa, with the conversions built into the expression.
- Report a density unit such as kg/m³ or g/L. These two units have the same numerical value: 1 kg/m³ = 1 g/L.
For US customary work, density may be reported in lb/ft³. Convert a result in kg/m³ by multiplying by approximately 0.06243. Use absolute pressure and Rankine temperature if applying an imperial form of the equation; mixing Fahrenheit with an SI gas constant will produce an invalid result.
Ideal Gas Limits and Real-Gas Corrections
The formula is an ideal-gas approximation. It is generally useful when gas molecules are sufficiently far apart that their interactions and molecular volume have little effect. At elevated pressure or near condensation, real gases can deviate noticeably, and the ideal formula may not predict density accurately.
A common correction uses the compressibility factor Z: ρ = pM/(ZRT). For an ideal gas, Z = 1; for a real gas, Z is determined from suitable property data or an equation of state at the specified gas composition, pressure, and temperature. If accuracy matters at high pressure or near a phase change, use reliable real-gas data rather than assuming Z equals one.
The equation is for gases, not a general liquid-density formula. Liquids are often only slightly compressible, and their density changes with temperature according to material-specific properties. Do not apply this gas equation to a liquid merely because its pressure and temperature are known.
Common Errors and Interpretation
- Gauge versus absolute pressure: entering gauge pressure as if it were absolute can substantially understate density, especially at low gauge pressures.
- Temperature conversion: 0°C is 273.15 K, not 0 K. A temperature of 0 K would make the equation undefined and is not an ordinary gas condition.
- Molar-mass mismatch: using air’s molar mass for another gas changes the answer in direct proportion to the error in M.
- Precision: extra calculator decimals do not make uncertain pressure, temperature, composition, or molar-mass data more accurate. Round the final value to sensible significant figures.
Density means mass divided by volume, so a value in kg/m³ can be read as kilograms of gas in one cubic metre at the stated conditions. Because gas volume changes with pressure and temperature, always state those conditions when reporting a gas density; the number is not a fixed property independent of its environment.
Frequently Asked Questions
What is the formula for density using pressure and temperature?
For an ideal gas, use ρ = pM/(RT), with absolute pressure p, molar mass M, gas constant R, and absolute temperature T.
Can I calculate gas density from pressure and temperature alone?
Not mass density unless you also know the gas’s molar mass or composition. Pressure and temperature alone determine ideal-gas molar density, p/(RT).
Should I use gauge pressure or absolute pressure?
Use absolute pressure. Convert a gauge reading by adding the surrounding atmospheric pressure, expressed in the same units.
Can I use Celsius in the density formula?
No. Convert Celsius to kelvins by adding 273.15 before substituting the temperature.
Does higher pressure always mean higher gas density?
For the same gas at fixed temperature, the ideal-gas formula predicts density rises in proportion to absolute pressure. Real-gas behavior can require a compressibility correction.
Related
Formula used
in p | Absolute pressure | kPa | 101.325 | 0 in T | Absolute temperature | K | 273.15 | 0 in M | Molar mass | g/mol | 28.97 | 0 out density | Gas density | kg/m^3 | p * 1000 * M / (8.314462618 * T) | 3 out molardensity | Molar density | mol/m^3 | p * 1000 / (8.314462618 * T) | 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, rounded as each result states. See how the calculators work or report an error.