For an ideal gas, density is calculated from pressure and temperature using ρ = PM/(RT), where P is absolute pressure, M is molar mass, R is the gas constant, and T is absolute temperature in kelvins. Enter those values below to get density in kg/m³; the result assumes ideal-gas behavior.
Formula
The ideal-gas density equation is:
ρ = PM / (RT)
- ρ is gas density, here reported in kilograms per cubic metre (kg/m³).
- P is absolute pressure in pascals (Pa). The calculator accepts kilopascals and converts them using 1 kPa = 1,000 Pa.
- M is molar mass in kilograms per mole (kg/mol). The calculator accepts grams per mole and converts using 1 g/mol = 0.001 kg/mol.
- R is the molar gas constant, exactly 8.31446261815324 J/(mol·K).
- T is absolute temperature in kelvins (K). Convert Celsius using T(K) = t(°C) + 273.15.
The second output is numerically equal to the first because 1 kg/m³ equals 1 g/L. This is a convenient alternative unit for gas densities.
Worked Example
Using the calculator defaults—pressure 101.325 kPa, molar mass 28.0134 g/mol, and temperature 25 °C—first convert to the units required by the equation:
- P = 101.325 × 1,000 = 101,325 Pa
- M = 28.0134 ÷ 1,000 = 0.0280134 kg/mol
- T = 25 + 273.15 = 298.15 K
Then substitute into the ideal-gas equation:
ρ = (101,325 × 0.0280134) ÷ (8.31446261815324 × 298.15)
ρ = 2,838.858255 ÷ 2,478.957026 ≈ 1.1452 kg/m³
The equivalent density is approximately 1.1452 g/L. Values are rounded to four decimal places, as in the calculator outputs. The example molar mass is for nitrogen gas (N₂), calculated from the abridged standard atomic weight of nitrogen, 14.007 g/mol, multiplied by two.
Assumptions
- The gas behaves ideally; intermolecular attractions and molecular volume are neglected.
- Pressure is absolute, not gauge pressure.
- Temperature is uniform and above absolute zero; Celsius is converted to kelvins.
- The entered molar mass describes the gas mixture or pure gas being considered.
How Pressure and Temperature Affect Density
At a fixed temperature and composition, ideal-gas density rises in direct proportion to absolute pressure. Doubling the pressure doubles the calculated density. At fixed pressure and composition, density is inversely proportional to absolute temperature: heating a gas makes its density lower if the pressure is held constant.
These comparisons depend on what is held constant. In a sealed, rigid container, heating does not let the gas expand; instead, pressure increases. For a fixed amount of ideal gas in a fixed volume, density stays the same while pressure and temperature change together. The equation remains consistent because pressure is not independent of temperature in that situation.
Pressure and temperature must describe the same location and state of the gas. For example, using a room’s atmospheric pressure with a temperature measured inside a pressurized vessel would not describe one gas state.
When the Equation Is Useful
This relation is useful when a gas’s mass per unit volume is needed but a direct density measurement is unavailable. It can support general calculations involving gas volumes, mass, or comparisons between conditions, provided the gas composition and state are known. For a mixture, use its average molar mass rather than the molar mass of one component.
It also helps explain why a gas density is not a single fixed property in the same way that the density of a particular solid is often tabulated. A gas’s density depends strongly on pressure and temperature. Any quoted gas density should therefore be interpreted alongside its reference conditions and composition.
Units, Pressure, and Common Errors
The most frequent mistake is using gauge pressure as though it were absolute pressure. Gauge pressure is measured relative to the surrounding atmosphere; absolute pressure is measured from a vacuum. Convert gauge pressure before calculating: absolute pressure equals gauge pressure plus local atmospheric pressure. A pressure of zero gauge, for instance, is approximately atmospheric pressure—not zero absolute pressure.
- Use kelvins in the formula. Do not insert a Celsius value directly or use a temperature difference as an absolute temperature.
- Check the molar-mass unit. The calculator expects g/mol, then converts it to kg/mol. Entering a value in kg/mol as though it were g/mol gives a result 1,000 times too small.
- Keep pressure units clear. The calculator accepts kPa; if a value is given in bar, convert it first using 1 bar = 100 kPa.
- Do not confuse density with specific gravity or relative density, which are ratios and have no units.
The displayed precision is not a guarantee of measurement accuracy. Real pressure, temperature, composition, and model uncertainty may be much larger than the final decimal place shown.
Ideal Gas Versus Real Gas
The ideal-gas equation is a useful approximation when gas molecules are sufficiently far apart that their interactions and individual volumes have little effect. It is often reasonable at moderate temperatures and pressures, but it can become inaccurate at high pressure, near condensation, or close to a substance’s critical point. The size and direction of the error depend on the gas and conditions.
For greater accuracy, use an appropriate real-gas equation of state or reliable property data for the specific gas at the stated pressure and temperature. Those methods may require substance-specific parameters or compressibility data. Do not assume one correction factor applies to every gas or condition.
Frequently Asked Questions
What is the gas density formula using pressure and temperature?
For an ideal gas, ρ = PM/(RT). Use absolute pressure, molar mass in compatible units, and temperature in kelvins.
Can I use Celsius in the density equation?
Not directly. Convert Celsius to kelvins by adding 273.15, then use the absolute temperature in the equation.
Does higher pressure increase gas density?
At a fixed temperature and composition, yes: ideal-gas density is directly proportional to absolute pressure.
Why does the calculator ask for molar mass?
Pressure and temperature alone do not determine density. Molar mass accounts for which gas, or which gas mixture, is present.
Is this formula accurate for every gas?
No. It assumes ideal behavior. At high pressures or near condensation, real-gas effects can matter and substance-specific data may be needed.
Related
Formula used
in p | Absolute pressure | kPa | 101.325 | 0 in mm | Molar mass | g/mol | 28.0134 | 0 in t | Temperature | °C | 25 | -273.15 out d | Gas density | kg/m³ | (p * 1000) * (mm / 1000) / (8.31446261815324 * (t + 273.15)) | 4 out dm | Gas density | g/L | 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
- 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