The density equation with pressure depends on whether the substance is a gas or a liquid. For an ideal gas, density is ρ = PM/(RT), where pressure, molar mass, and absolute temperature determine mass per volume; enter those values in the calculator below to get density in kg/m³ and g/L.
Formula
The ideal-gas density equation is:
ρ = PM / (RT)
- ρ is density in 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 kg/mol. The calculator accepts g/mol and converts it by dividing by 1,000.
- R is the molar gas constant, 8.31446261815324 J/(mol·K).
- T is absolute temperature in kelvins (K), calculated from Celsius as T = t + 273.15.
The equation follows from the ideal gas law, PV = nRT, and the definition of density, ρ = mass/volume. Since mass equals the amount of gas in moles multiplied by molar mass, substituting into the ideal gas law gives ρ = PM/(RT). Pressure must be absolute, not gauge pressure; temperature must be in kelvins, not degrees Celsius.
Worked Example
Using the calculator defaults—P = 101.325 kPa, M = 28.97 g/mol, and t = 0 °C—convert each input to the units in the equation:
- P = 101.325 × 1,000 = 101,325 Pa
- M = 28.97 / 1,000 = 0.02897 kg/mol
- T = 0 + 273.15 = 273.15 K
Substitute into the ideal-gas equation:
ρ = (101,325 × 0.02897) / (8.31446261815324 × 273.15) ≈ 1.292 kg/m³
Because 1 kg/m³ equals 1 g/L, the equivalent result is 1.292 g/L. The calculator rounds both displayed values to three decimal places. This is an ideal-gas estimate using the selected molar mass, not a measured value for a particular gas mixture.
Assumptions
- The gas behaves ideally under the stated pressure and temperature.
- Pressure is absolute pressure, and the gas has a single representative molar mass.
- Temperature is converted to kelvins; the input cannot be below absolute zero.
- The result is a calculated mass per volume, not a direct laboratory measurement.
How Pressure Changes Density
At fixed temperature and molar mass, the ideal-gas equation makes density directly proportional to absolute pressure. Doubling the pressure doubles the calculated density, provided the gas remains close enough to ideal behavior. At fixed pressure and composition, density is inversely proportional to absolute temperature: heating a gas lowers its density as it expands.
For example, air at a higher altitude generally has lower density because atmospheric pressure is lower. A weather report may give pressure in kilopascals or hectopascals, while a pressure gauge may report pressure relative to the surrounding atmosphere. The latter is gauge pressure. To use this equation, add local atmospheric pressure to gauge pressure to obtain absolute pressure. A negative gauge reading can still represent positive absolute pressure; using gauge pressure directly would produce an incorrect result.
The formula also shows why the same gas does not have one universal density. A density value is meaningful only alongside its temperature and pressure, and for mixtures it also depends on composition.
Gases, Liquids, and Real-Gas Limits
This pressure equation is chiefly useful for gases. Liquids are much less compressible, so their density usually changes far less with ordinary pressure changes. For a liquid, use a reliable density value or an equation of state that accounts for the liquid and its conditions; ρ = PM/(RT) is not a general liquid-density formula.
Real gases also depart from the ideal-gas model, especially at high pressure or near condensation. A common correction uses the compressibility factor Z:
ρ = PM / (ZRT)
Here Z is dimensionless; ideal behavior corresponds to Z = 1. For a real gas, Z depends on the substance and its pressure and temperature, so it must come from appropriate property data or a validated equation of state. The calculator does not estimate Z. Its result should therefore be treated as an ideal approximation when non-ideality matters.
Choosing Inputs and Units
Before calculating, identify the gas composition and use a molar mass consistent with it. Dry air is often approximated with a molar mass near 28.97 g/mol, but humid air has a different average molar mass because water vapor is lighter than the main components of dry air. For a pure gas, use that gas’s molar mass. For a mixture, use its composition-weighted average molar mass.
- Use absolute pressure in kPa for this calculator. Convert other units before entering them; for example, 1 bar = 100 kPa and 1 atm = 101.325 kPa.
- Enter temperature in °C. The calculator adds 273.15 to convert to kelvins.
- Enter molar mass in g/mol, not kg/mol. The calculator performs the required division by 1,000.
- Keep enough significant figures in input values for the precision needed. A result with many decimal places is not necessarily more accurate than the input data.
Density units can be converted when comparing with tables. For gases, kg/m³ and g/L have the same numerical value: 1 kg/m³ = 1 g/L. By contrast, 1 g/cm³ = 1,000 kg/m³, a scale that is more commonly encountered for liquids and solids.
Common Mistakes and Practical Limits
The most common errors are substituting gauge pressure for absolute pressure, putting Celsius directly into the denominator, and mixing g/mol with kg/mol. Each creates a potentially large error. Check that the temperature is above −273.15 °C and that pressure is positive on an absolute scale.
Calculated density also describes the conditions entered, not necessarily the conditions inside a container or at a measurement location. A gas may have gradients in temperature or pressure, and a mixture may change composition through humidity or other constituents. For precision work, compare the ideal result with reference property data or a suitable real-gas model, and state the measurement conditions with the density.
When using the result to plan bench work, follow your lab method, the safety data sheet (SDS) and your supervisor. This calculator is for general scientific arithmetic, not a substitute for a validated method or instrument measurement.
Frequently Asked Questions
What is the density equation using pressure?
For an ideal gas, density is ρ = PM/(RT). Use absolute pressure, molar mass in units compatible with R, and temperature in kelvins.
Does higher pressure increase density?
For an ideal gas at constant temperature and composition, yes: density rises in direct proportion to absolute pressure. Real gases can depart from this relationship at conditions where ideal behavior is a poor approximation.
Can I use gauge pressure in the density equation?
Not directly. Convert gauge pressure to absolute pressure by adding the local atmospheric pressure, then use that absolute value.
Why must temperature be in kelvins?
The gas law uses absolute temperature, whose zero corresponds to absolute zero. Celsius values must be converted with K = °C + 273.15.
Does this equation work for liquids?
No, not as a general liquid-density equation. Liquids are comparatively difficult to compress, and their density should be obtained from liquid-specific data or a suitable model.
Why might calculated gas density differ from a reference value?
Possible reasons include different temperature or pressure conditions, a different gas composition, humidity, rounded molar mass, or non-ideal gas behavior.
Related
Formula used
in p | Absolute pressure | kPa | 101.325 | 0 in mm | Molar mass | g/mol | 28.97 | 0 in t | Temperature | °C | 0 | -273.15 out rho | Ideal-gas density | kg/m^3 | p * 1000 * (mm / 1000) / (8.31446261815324 * (t + 273.15)) | 3 out gl | Ideal-gas density | g/L | rho | 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