Van der Waals Gas Calculator

Real-gas pressure, volume and the liquid-gas coexistence.

  • Cubic volume roots
  • Critical constants
  • Maxwell construction
A small rounded clay table holding a sealed rounded clay vessel part full of packed round beads, a few drifting above, with a soft clay hand pump beside it.

The guide

Van der Waals made a gas and a liquid one curve, and a cubic in the volume says where they part

How two constants, a and b, turn the ideal gas law into a cubic with up to three volumes, a critical point at 3/8, and a condensation line drawn by equal areas.

  • 3 roots carbon dioxide at 280 K and 50 bar: 0.0865, 0.1162, 0.3055 L/mol
  • 54.74 bar condensation pressure of carbon dioxide at 280 K, from equal areas
  • 0.375 critical compressibility factor, 3/8, for every van der Waals gas
  • 1014.7 K Boyle temperature of carbon dioxide, 27/8 of its critical value
  • 22.455 bar carbon dioxide at 300 K and 1 L/mol, against 24.943 ideal
Read the full guide Fold the guide 6 min · 15 sources

The ideal gas law treats molecules as points that never touch. That works for thin gas and fails exactly where it gets interesting, when the gas is squeezed toward a liquid.

Johannes van der Waals fixed this in 1873, in his doctoral thesis, with two small corrections. His equation reads P = RT / (V - b) - a / V^2. It can be written on one line and it still describes how a gas condenses, which the ideal law cannot do at all.

What the two constants stand for

Start with b. Molecules take up room, so a mole of gas cannot be squeezed into less than a certain volume, however hard you push. The molar volume V in the equation is therefore replaced by V - b, the free volume. Van der Waals modelled molecules as hard spheres and found that b is four times the volume of the spheres themselves.

Now a. Molecules also attract one another a little, and that pull lowers the pressure the gas can push with. Van der Waals argued that the attractive pressure is proportional to the square of the density, which is why the term is a / V^2: the closer the molecules are packed, the faster the pull grows. Note the sign. The excluded volume raises the pressure and the attraction lowers it. A quick answer that adds a / V^2, or forgets b, is simply wrong, and the page shows all three versions side by side for your numbers.

Where do the constants come from? Reference tables list them in litres squared bar per mole squared for a and litres per mole for b. For many gases they are calculated from the measured critical pressure and temperature, so they are fitted numbers, not independent measurements of molecule size. Argon shows the effect: its constants give a critical temperature of 150.85 K and a pressure of 48.98 bar, and the NIST Chemistry WebBook lists measured values of 150.86 K and 48.98 bar. The page takes the constants from the Wikipedia data page and says so.

Why the cubic has up to three roots

Ask for the pressure at a given volume and temperature and the answer is one number. Ask the opposite question, the volume at a given pressure, and the equation must be rearranged. Multiply through by V^2 (V - b) and you get P V^3 - (P b + R T) V^2 + a V - a b = 0, a cubic in V.

A cubic has one or three real roots, and here that is physics. Above the critical temperature, the pressure falls steadily as the volume grows, so each pressure meets the curve once. Below it, the isotherm has a dip and a hump, and a horizontal line at the right height cuts it three times.

Those three volumes have names. The smallest is liquid-like, the largest is gas-like, and the one between them sits on a stretch where the pressure rises as the volume grows. That cannot be stable: squeeze it slightly and the pressure falls, so it keeps collapsing. The two turning points, where the slope is zero, are the spinodal volumes, and no real sample stays between them.

How a program finds the roots matters. Trigonometric and Cardano formulas give them directly, but they can lose accuracy where roots nearly coincide, as they do close to the critical point. This page brackets each root between the spinodal volumes, polishes it with Newton steps, and then puts every root back into the pressure equation and prints the leftover. A second, independent method, the Cardano formulas, must agree before the page says so.

The critical point and the line the equal areas draw

Set the slope and the curvature of the isotherm to zero together and one special point remains. Its volume is 3b, its temperature is 8a / (27 R b), and its pressure is a / (27 b^2). Multiply the pressure and volume and divide by R times the temperature, and every constant cancels: the critical compressibility factor is 3/8, or 0.375.

That number is a prediction, and it is a rough one. Real fluids have a critical value of Z between about 0.23 and 0.31, so van der Waals gases are a little too compressible at the critical point. Still, a single universal number from a two-constant equation was remarkable in the 1870s.

Measure the constants in units of the critical values and they vanish altogether. The reduced equation, p = 8t / (3v - 1) - 3 / v^2, has no gas-specific constants in it. Every van der Waals gas at the same reduced temperature follows the same curve, which is the law of corresponding states.

Below the critical temperature the isotherm wiggles, yet a real sample condenses at one steady pressure. Which pressure? James Clerk Maxwell answered in 1875: draw the horizontal line that cuts off two equal areas, one above the line and one below it. This is the equal-area rule. Josiah Willard Gibbs later showed that it is equivalent to the condition for material equilibrium between the two phases.

On this page the root of the area equation is found with Brent’s method, working on the logarithm of the pressure so that tiny saturation pressures at low temperature are not lost. The answer is then checked three ways: a numerical integral of the area, the pressure at both end volumes, and the equal Gibbs energy form of the condition.

A worked example you can reproduce

Take carbon dioxide with a = 3.6 and b = 0.04267. The critical temperature comes out at 300.66 K, the critical pressure at 73.23 bar and the critical volume at 0.12801 L/mol. Measured values listed by the NIST Chemistry WebBook are close, about 304.2 K and 73.8 bar, so the model is rough but in the right place.

Ask for the volume of carbon dioxide at 280 K and 50 bar. The cubic gives 3 roots: 0.0865, 0.1162 and 0.3055 L/mol, with compressibility factors of 0.186, 0.250 and 0.656. Each root, put back, returns 50 bar to rounding.

Which one would you see? The equal-area line at 280 K sits at 54.74 bar, with a liquid volume of 0.08296 and a gas volume of 0.24933 L/mol. Fifty bar is below that, so the gas is the stable state, and the liquid-like root is metastable: a liquid held below its saturation pressure that has not yet boiled, the delayed evaporation that Boltzmann described.

Now squeeze the same gas to 0.15 L/mol. The equation says 56.91 bar, but this volume lies between the two coexisting volumes, so a real sample is a mixture at 54.74 bar. The lever rule gives about 59.7 percent of the moles as liquid. The vessel on the page packs that share of its beads into a pool and lets the rest float.

At 300 K and 1 L/mol the equation gives 22.455 bar, against 24.943 bar for the ideal gas, so Z is 0.9002. Dropping b gives 21.343 bar, and adding the attraction gives 29.655 bar. Both slips are easy to make and both are far off.

The Boyle temperature, a / (R b), is the temperature at which the second virial coefficient vanishes, and there the gas stays close to ideal over a wider range of pressures. For carbon dioxide it is 1014.7 K, exactly 27/8 of the critical temperature. Above it Z climbs above 1 under pressure, as it does for helium at 300 K and 100 bar, where Z is 1.091.

What the model cannot do

The equation is a model, and a fairly old one. Real fluids differ from it near the critical point, and in the liquid it is at best a qualitative guide. Modern engineering uses many revised cubic equations of state, and none of them is covered here.

Mixtures need mixing rules, and real-fluid tables hold measured data that no two-constant equation reproduces. The page takes no position on those. It answers one question well: what the van der Waals equation says, solved correctly and checked.

There are stated limits as well. Constants run from 0.01 to 50 for a and from 0.01 to 0.5 for b, temperatures from 1 K to 2000 K, and pressures from 0.001 to 5000 bar. The Maxwell line is computed for reduced temperatures from 0.2 up to just below 1, because below that the saturation pressure is a millionth of the critical pressure and the equation means little.

The heavy work runs in a background worker, and the numbers are formatted with the browser’s own number formatting. Nothing you type leaves the page.

Sources

Every source consulted for this guide. Links checked November 10, 2026.

  1. Van der Waals equation Wikipedia (CC BY-SA)
  2. Van der Waals constants (data page) Wikipedia (CC BY-SA)
  3. Maxwell construction Wikipedia (CC BY-SA)
  4. Critical point (thermodynamics) Wikipedia (CC BY-SA)
  5. Compressibility factor Wikipedia (CC BY-SA)
  6. Boyle temperature Wikipedia (CC BY-SA)
  7. Spinodal Wikipedia (CC BY-SA)
  8. Johannes Diderik van der Waals Wikipedia (CC BY-SA)
  9. Cubic equation Wikipedia (CC BY-SA)
  10. Brent's method Wikipedia (CC BY-SA)
  11. CODATA Value: molar gas constant National Institute of Standards and Technology
  12. Carbon dioxide: phase change data NIST Chemistry WebBook, National Institute of Standards and Technology
  13. Argon: phase change data NIST Chemistry WebBook, National Institute of Standards and Technology
  14. Web Workers API MDN Web Docs (CC BY-SA)
  15. Intl.NumberFormat MDN Web Docs (CC BY-SA)