Calculate a gas’s density from its pressure, temperature, and molar mass using the ideal-gas relationship. Enter absolute pressure, temperature in °C, and molar mass in g/mol; the calculator returns density in g/L, along with the converted temperature and pressure in SI units.
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³ (numerically equal to g/L).
- P is absolute pressure in pascals (Pa).
- M is molar mass in kilograms per mole (kg/mol).
- R is the universal gas constant, 8.31446261815324 J/(mol·K).
- T is absolute temperature in kelvins (K), calculated here as temperature in °C + 273.15.
The calculator accepts pressure in kPa and molar mass in g/mol, so its expression explicitly converts kPa to Pa by multiplying by 1000 and g/mol to kg/mol by dividing by 1000. Those factors cancel numerically, giving the displayed density in g/L. This is the same numerical value as kg/m³ because 1 g/L = 1 kg/m³.
Worked Example
Using the defaults—101.325 kPa, 20 °C, and molar mass 28.0134 g/mol—first convert the conditions and molar mass:
- Pressure: 101.325 kPa × 1000 = 101325 Pa.
- Temperature: 20 + 273.15 = 293.15 K.
- Molar mass: 28.0134 g/mol ÷ 1000 = 0.0280134 kg/mol.
Substitute into the ideal-gas formula:
ρ = (101325 Pa × 0.0280134 kg/mol) ÷ (8.31446261815324 J/(mol·K) × 293.15 K) ≈ 1.1634 kg/m³.
Since 1 kg/m³ = 1 g/L, the calculator’s headline result is 1.1634 g/L. The inputs describe nitrogen’s approximate molar mass at 20 °C and one standard atmosphere; the result is an ideal-gas estimate.
Assumptions
- The gas behaves ideally at the entered pressure and temperature.
- Pressure is absolute, not gauge pressure.
- Temperature is entered in °C and converted to K using +273.15.
- Molar mass is a suitable value for the gas or gas mixture being considered.
- The result is a calculated estimate, not a measurement of a real sample.
How the Calculation Works
The ideal gas law is PV = nRT, where volume is V and amount of gas is n. Density is mass divided by volume. For n moles, mass is nM, so density is nM/V. Rearranging the ideal gas law gives n/V = P/(RT); substituting this into density produces ρ = PM/(RT).
This derivation shows why density rises with pressure and molar mass, and falls as absolute temperature rises. At fixed temperature and gas composition, doubling absolute pressure doubles the ideal-gas density. At fixed pressure and composition, warming the gas lowers its density because the same pressure corresponds to fewer moles per unit volume.
Use the molar mass of the actual gas. For a pure gas, it is the substance’s molecular molar mass. For a mixture, use its mole-fraction-weighted average molar mass: add each component’s mole fraction multiplied by that component’s molar mass. Mole fractions must sum to 1. If composition changes, density can change even when pressure and temperature remain the same.
Using the Result and Choosing Inputs
Enter pressure as an absolute pressure: the pressure measured relative to a perfect vacuum. Many weather reports and gas-system readings instead use gauge pressure, which is relative to local atmospheric pressure. Convert gauge pressure before calculating:
Absolute pressure = gauge pressure + local atmospheric pressure.
For example, a gauge reading of 200 kPa does not mean the gas is at 200 kPa absolute; local atmospheric pressure must be added. Use the actual local atmospheric pressure when accuracy matters. Never enter a negative absolute pressure.
Temperature must be on an absolute scale inside the formula. The calculator accepts °C and adds 273.15. Do not enter a Celsius value directly as kelvins. A temperature of 0 °C is 273.15 K, not 0 K. Temperatures below absolute zero are physically impossible and are rejected.
Check that the molar mass matches the chemical identity and units. A value in g/mol is required. For instance, nitrogen gas is N₂, not atomic nitrogen, so its molar mass is about 28.014 g/mol rather than about 14.007 g/mol. The default uses 28.0134 g/mol as a representative value; small differences in tabulated atomic weights or rounding slightly affect the answer.
Ideal Gas Versus Real Gas
The ideal-gas equation treats particles as having negligible volume and negligible intermolecular forces. It is often a useful approximation at relatively low pressure and sufficiently high temperature, but it can be inaccurate when a gas is compressed strongly or is near condensation. Under those conditions, molecular interactions and molecular volume matter.
A common real-gas correction uses the compressibility factor Z: ρ = PM/(ZRT). For an ideal gas, Z = 1. For a real gas, Z depends on the substance and its pressure and temperature; it is not a universal correction. Reliable values may come from validated property tables, an equation of state, or measured data. This calculator does not estimate Z, so do not interpret extra displayed decimal places as proof of real-gas accuracy.
For a gas mixture, non-ideal behavior can also depend on composition. Near a phase change, a simple ideal-gas density calculation may be especially misleading because some material may be liquid rather than gas. Use a suitable real-fluid property method when engineering, safety, or process decisions depend on precise density.
Common Mistakes and Limits
- Using gauge pressure as absolute pressure: add local atmospheric pressure first.
- Mixing units: this calculator expects kPa, °C, and g/mol. The formula converts to Pa, K, and kg/mol.
- Using Celsius in place of kelvins: convert with T(K) = t(°C) + 273.15.
- Choosing the wrong molecular form: use the gas molecule’s molar mass, not an element’s atomic mass when the gas is molecular.
- Assuming the gas is ideal at every condition: high pressure, low temperature, or proximity to condensation can require real-gas data.
- Over-reading precision: the answer’s digits do not account for uncertainty in pressure, temperature, composition, or the model.
The formula gives density for the stated equilibrium conditions. It does not determine how quickly a gas flows, how much fits in a container without its volume, or whether a particular gas is safe to handle. Where bench work is implied, follow your lab method, the safety data sheet (SDS), and your supervisor.
Frequently Asked Questions
What is the formula for gas density from pressure and temperature?
For an ideal gas, use ρ = PM/(RT), with absolute pressure in Pa, molar mass in kg/mol, temperature in K, and R = 8.31446261815324 J/(mol·K).
Can I calculate gas density without molar mass?
Not from pressure and temperature alone using this formula. You also need the gas’s molar mass, or an appropriate average molar mass for a mixture.
Is gas density in g/L the same as kg/m³?
Yes. The numerical values are identical: 1 g/L equals 1 kg/m³.
Should pressure be gauge or absolute?
Use absolute pressure. If your reading is gauge pressure, add local atmospheric pressure to it before calculating.
Why does heating a gas reduce its density?
At fixed pressure and composition, a higher absolute temperature means fewer gas moles per unit volume under the ideal-gas law, so mass per unit volume decreases.
Does this work for every gas?
It gives an ideal-gas estimate. Real gases can depart from that estimate, especially at high pressures or near condensation; use a real-gas model or property data when those effects matter.
Related
Formula used
in p | Absolute pressure | kPa | 101.325 | 0 in t | Temperature | °C | 20 | -273.15 in m | Molar mass | g/mol | 28.0134 | 0 out d | Gas density | g/L | (p * 1000) * (m / 1000) / (8.31446261815324 * (t + 273.15)) | 4 out tk | Temperature | K | t + 273.15 | 2 out pa | Absolute pressure | Pa | p * 1000 | 0
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 = Height × Density? The Formula Explained
- Hydrostatic Pressure: Density × Gravity × Height98,066 Pa
- Pressure Divided by Density: Units and Meaning101.3250 m²/s²
- Pressure Drop K Value Calculator and Formula0.5000
- Pressure Difference, Height, Density, and Gravity Calculator9,806.65 Pa
- Pressure Divided by Density: Meaning and Calculation101.325 J/kg