Ideal Gas Density Calculator
Enter the pressure, temperature, and molar mass of a gas to calculate its density using the ideal gas law. Select from 15 built-in gas presets or enter any custom molar mass. Switch pressure units between Pa, kPa, bar, atm, and psi. Switch temperature between Kelvin, Celsius, and Fahrenheit. The density output can be shown in kg/m3, g/L, g/cm3, or lb/ft3. The step panel shows every stage of the math with your actual numbers.
Formula
Worked example
Dry air at 1 atm (101325 Pa) and 15 C (288.15 K): M = 28.966 g/mol = 0.028966 kg/mol. rho = 101325 * 0.028966 / (8.31446 * 288.15) = 2935.5 / 2395.5 = 1.225 kg/m3. The specific gas constant is Rs = 8.31446 / 0.028966 = 287.1 J/(kg*K).
What is ideal gas density and how is it calculated?
The density of an ideal gas is the mass of the gas per unit volume at a given pressure and temperature. It is derived directly from the ideal gas law PV = nRT. Rearranging: n/V = P/(R_bar * T), and because mass = n * M (molar mass), density equals rho = P * M / (R_bar * T). Here P is absolute pressure in Pascals, M is molar mass in kg/mol, R_bar is the universal gas constant (8.31446 J/(mol*K)), and T is absolute temperature in Kelvin. Density increases when pressure rises and decreases when temperature rises, which explains why hot air rises and compressed gas is heavier than the same gas at ambient pressure.
Specific gas constant and the alternative density formula
Every gas has a specific gas constant Rs defined as Rs = R_bar / M. For dry air, Rs = 8.31446 / 0.028966 = 287.1 J/(kg*K). The density formula then simplifies to rho = P / (Rs * T), which is particularly convenient in engineering because Rs is tabulated for common gases and eliminates the need to work with molar masses. This calculator outputs Rs alongside the density so you can verify the alternative form. Both formulas give identical results; the choice depends on which constants are most readily available for your gas.
Unit conversions and when to use each pressure unit
This calculator accepts pressure in Pa, kPa, MPa, bar, atm, psi, and mmHg, and temperature in Kelvin, Celsius, and Fahrenheit. Standard atmospheric pressure is 101325 Pa, 101.325 kPa, 1.01325 bar, 1 atm, 14.696 psi, or 760 mmHg. Engineering applications in the oil and gas industry typically use bar or psi; academic work in chemistry uses atm or Pa; meteorology uses Pa or hPa (= mbar). Always use absolute pressure in the formula, not gauge pressure. Gauge pressure (what a tire gauge reads) is pressure above atmospheric, so add 101325 Pa to convert to absolute before entering it here.
When does the ideal gas law break down?
The ideal gas law assumes gas molecules have no volume of their own and exert no intermolecular forces. These assumptions hold well at low pressures (below about 1-2 MPa for most gases) and high temperatures (well above the boiling point). Near the critical point, at very high pressures, or at temperatures close to the dew point, real-gas behavior diverges noticeably from ideal. Steam near saturation, CO2 near its critical point (31 C, 7.4 MPa), and heavy hydrocarbons at pipeline pressures are common cases where a real-gas equation of state (van der Waals, Peng-Robinson, or NIST REFPROP data) should be used instead.
Gas densities at standard conditions (0 C, 1 atm)
| Gas | Formula | Molar mass (g/mol) | Density at STP (kg/m3) |
|---|---|---|---|
| Hydrogen | H2 | 2.016 | 0.0899 |
| Helium | He | 4.003 | 0.1786 |
| Methane | CH4 | 16.043 | 0.7158 |
| Steam | H2O | 18.015 | 0.8040 |
| Neon | Ne | 20.180 | 0.9002 |
| Nitrogen | N2 | 28.014 | 1.2496 |
| Air (dry) | N2/O2 | 28.966 | 1.2923 |
| Carbon monoxide | CO | 28.010 | 1.2494 |
| Ethylene | C2H4 | 28.054 | 1.2514 |
| Oxygen | O2 | 31.998 | 1.4277 |
| Argon | Ar | 39.948 | 1.7824 |
| Carbon dioxide | CO2 | 44.010 | 1.9635 |
| Propane | C3H8 | 44.097 | 1.9674 |
| Butane | C4H10 | 58.122 | 2.5934 |
Ideal-gas densities for common gases at standard temperature and pressure (STP: 0 C, 101325 Pa). Values calculated using rho = PM / (R_bar * T).
Frequently asked questions
What is the density of air at room temperature and pressure?
Dry air at 20 C (293.15 K) and 1 atm (101325 Pa) has a density of about 1.204 kg/m3 (or g/L). At 15 C it is about 1.225 kg/m3, and at 0 C it is about 1.293 kg/m3. Humidity reduces density slightly because water vapor (M = 18 g/mol) is lighter than dry air (M = 28.97 g/mol).
Why does density decrease as temperature increases?
At constant pressure, adding heat causes gas molecules to move faster and collide with the container walls more forcefully, so the volume expands. If the volume is allowed to expand (like in the atmosphere), the same number of molecules now occupies more space, making density lower. The relationship is inversely proportional: doubling absolute temperature at constant pressure halves the density.
How do I convert from gauge pressure to absolute pressure?
Gauge pressure is measured relative to atmospheric pressure. Absolute pressure = gauge pressure + atmospheric pressure. At sea level, atmospheric pressure is approximately 101.325 kPa, 14.696 psi, or 1 atm. For example, a tire inflated to 32 psi gauge has an absolute pressure of 32 + 14.696 = 46.7 psi. Always enter absolute pressure in the ideal gas density formula.
What is the difference between density and specific gravity for gases?
Density is mass per unit volume (kg/m3 or g/L). Specific gravity for gases is the ratio of the gas density to the density of dry air at the same temperature and pressure, making it dimensionless. A specific gravity below 1 means the gas is lighter than air and will rise; above 1 it sinks. For example, methane has a specific gravity of about 0.554 (it rises) while propane is about 1.52 (it sinks and can pool in low areas).
Can I use this calculator for mixtures of gases?
Yes, for ideal gas mixtures use the mixture molar mass, which is the mole-fraction-weighted average of the component molar masses. For example, dry air is approximately 78.09% nitrogen (28.014 g/mol), 20.95% oxygen (31.998 g/mol), and 0.93% argon (39.948 g/mol), giving a mixture molar mass of about 28.966 g/mol. Enter that mixture molar mass in the custom gas field to calculate the mixture density.
Why is 8.31446 J/(mol*K) used as the gas constant?
The universal gas constant R_bar = 8.31446261815324 J/(mol*K) was fixed exactly in the 2019 revision of the SI. It relates the macroscopic properties of an ideal gas (pressure, volume, temperature, amount in moles) in the equation PV = nRT. In different unit systems it appears as 0.0831446 L*bar/(mol*K) or 1.98722 cal/(mol*K), but this calculator always converts inputs to SI units first to avoid unit errors.