Type what you know about the gas —pressure, volume, temperature, moles, mass or density— and leave empty what you are looking for: the calculator solves for the unknown with the ideal gas law, explains the constant R in your units and warns when the data disagree. At high pressure or low temperature it compares the ideal gas with three real-gas equations.
Theory and worked examples: Ideal and real gases.
A gas is described by four quantities: pressure P, volume V, amount n (moles) and temperature T. In an ideal gas the molecules take up no room and do not attract each other, and the four are tied by a single equation. This guide explains that equation, the combined gas law, mixtures (Dalton's law) and when to switch to a real gas, with examples solved in the calculator.
P · V = n · R · T
T is always in kelvin (T = t + 273.15). R is the same constant written in different units: 8.314 J/(mol·K) = 8.314 kPa·L/(mol·K) = 0.082057 L·atm/(mol·K) = 62.364 L·mmHg/(mol·K). Use the one that matches the units of P and V. The molar mass M turns mass into moles (n = m/M), and combining with the density gives ρ = P·M/(R·T): a measured density gives the molar mass of an unknown gas.
A 10.0 L tank holds CO2 at 5.00 atm and 20 °C. How many grams are there?
When the same gas goes from one state to another, PV/(nT) has the same value before and after: P1V1/(n1T1) = P2V2/(n2T2). What does not change cancels out, leaving the named cases: Boyle (T and n constant, P·V constant), Charles (P constant, V/T constant), Gay-Lussac (V constant, P/T constant) and Avogadro (P and T constant, V/n constant).
Example: 500 mL of gas at 740 mmHg and 22 °C is brought to 0 °C and 760 mmHg. With the temperatures in kelvin (295.15 K and 273.15 K): V2 = 500 × (740/760) × (273.15/295.15) = 450.6 mL. Check: P·V/T = 1254 mmHg·mL/K in both states.
In a mixture of ideal gases each gas exerts the pressure it would have alone in the vessel (its partial pressure), and the total is the sum: P = Σ Pi, with Pi = xi·P and xi = ni/ntotal. The mean molar mass is M̄ = Σ xi·Mi (dry air gives about 28.96 g/mol).
Gas collected over water: 250 mL of O2 collected over water at 25 °C with a barometric pressure of 755 mmHg. The gas comes out saturated with vapor; the vapor pressure of water at 25 °C is 23.78 mmHg, so P(O2) = 755 − 23.78 = 731.2 mmHg and n = P·V/(R·T) = 731.2 × 0.25 / (62.364 × 298.15) = 0.009832 mol (0.3146 g). Forgetting the water vapor would make the result 3.25 % too high.
At high pressure or near the critical point the molecules do take up room and attract each other. The compressibility factor Z = P·v/(R·T) (v = V/n) measures the difference: Z = 1 is ideal. The cubic equations correct the ideal gas with just the critical temperature and pressure (and the acentric factor ω): van der Waals, P = RT/(v − b) − a/v², with a = 27R²Tc²/(64Pc) and b = RTc/(8Pc); Redlich–Kwong and Peng–Robinson, which refine the attraction term.
Example: 1 mol of CO2 in 0.500 L at 300 K. The ideal gas gives 49.89 bar; van der Waals 39.94 bar (Z = 0.8005), Redlich–Kwong 38.95 bar and Peng–Robinson 38.2 bar, against 38.74 bar from the reference equation of state of CO2. The ideal gas is 28.8 % too high; the cubics are within a few percent. If the pressure is given and the volume is sought, the cubic can have three roots: the smallest is the liquid, the largest the vapor, and the stable one has the lowest fugacity.
About Simuveliq · How we verify the calculations · Terms of use · Privacy policy · Contact
© 2026 Simuveliq. All rights reserved.