Density falls when most substances get hotter and rises when they get colder, because heating makes atoms and molecules move faster and spread farther apart, so the same mass occupies a larger volume. That rule holds for gases, liquids, and most solids. Water is the famous exception: between 0 °C and 4 °C it contracts as it warms, so liquid water is densest at about 4 °C.

That single counterexample explains why ice floats, why lakes freeze from the top down, and why fish survive winter. Everything else in this explainer is the machinery behind the headline: the atomic mechanism, the numbers that govern real systems, the edge cases where temperature stops being the main lever, and the practical thresholds that matter if you are calibrating a hydrometer, checking engine oil, or designing a cooling loop.

The atomic mechanism behind thermal expansion

Temperature is a measure of average kinetic energy. In a solid, atoms vibrate around fixed lattice positions. Heat them and the vibrations grow, so each atom's average displacement from its rest position increases. Because interatomic forces are asymmetric, the average separation grows too, and the material expands.

In a liquid or gas, the same logic applies without a fixed lattice. Molecules move faster and collide harder, so the average distance between them increases. Density is mass divided by volume, and the mass does not change, so expansion is a direct density loss. For an ideal gas at constant pressure, the relationship is exactly linear in absolute temperature: volume scales with kelvin, so density scales inversely.

The proportionality constant differs by phase. Thermal expansion of solids is measured by a coefficient of linear expansion, typically expressed in parts per million per degree Celsius. Gases use a volumetric coefficient near 1/273 per °C at 0 °C, which is why cylinder and pipeline systems must account for gas temperature. Liquids sit in between and are far less predictable, because their molecules retain some local structure that changes nonlinearly with heat.

One useful mental model: expansion is not the atoms themselves growing. It is the average gap between them increasing. A steel rail expands about 11 parts per million per °C, which is 0.66 inches per 100 feet over 100 °F. Small per-degree numbers compound into millimeters over engineering distances.

Quantified context: how much density changes per degree

Gases change density dramatically with temperature at fixed pressure. Air at sea level drops from about 1.29 kilograms per cubic meter at 0 °C to roughly 1.18 at 25 °C, a loss of near 9 percent. That is why hot air rises and why a hot-air balloon needs a large envelope to lift its payload. Pumps, ducts, and fans sized for cold air undershoot their mass-flow targets on hot days, even if volumetric flow looks fine.

Liquids change far less. Warm water from 4 °C to 20 °C loses about 0.18 percent of its density, moving from a maximum near 999.97 kilograms per cubic meter at 4 °C to about 998.2 at 20 °C. Heating the same water from 20 °C to 80 °C drops it to roughly 971.8, a further 2.6 percent. Over a full 20 °C to 100 °C span, water loses about 4 percent of its density, which is enough to reshuffle any precision measurement.

Solids change least of all in percentage terms. Aluminum expands around 23 parts per million per °C, so its density at 200 °C is roughly 0.3 to 0.4 percent lower than at room temperature. Steel sits near 11 to 13 parts per million.

The follow-on quantity people often want is volumetric change. For isotropic solids, the volume coefficient is roughly three times the linear coefficient, so aluminum's volumetric expansion is about 69 parts per million per °C. That single multiplier lets you convert from a tabulated linear value to a density correction without any special formula.

These numbers reconcile cleanly once you are consistent. Density change equals the negative of volumetric expansion to a very good approximation for small changes: a 1 percent volume increase is a 1 percent density decrease. When a source quotes a density like 998.2 kilograms per cubic meter at 20 °C and another quotes 999.97 at 4 °C, both can be right; the discrepancy is temperature, not error.

The water anomaly and other edge cases

Water is the case that trips up every calibration and every intuition. As it warms from 0 °C to 4 °C, the hydrogen-bond network reorganizes in a way that packs molecules closer, so density increases. Above 4 °C the ordinary thermal expansion takes over and density falls. At the freezing boundary, water expands sharply as it forms ice, so ice is about 8 to 9 percent less dense than the liquid it came from. That is why icebergs float, why a full bottle left in a freezer can crack, and why freezing a pipe can split it.

Several other substances show small pre-melting anomalies. Zirconium and titanium and some alloys contract slightly on heating near certain phase boundaries, and some polymer and glass systems show dimpled expansion curves. The physical cause is a structural rearrangement that outweighs simple thermal vibration over a narrow temperature band. This is a professional caveat worth stating plainly: any density-temperature table that assumes monotonic expansion can be wrong in a phase-transition window. Always check whether a table's temperature span crosses one.

The most important edge case of all for daily life is buoyancy. Because density is a function of temperature, and temperature is usually not uniform in a real room, tank, or ocean, local density differences drive flow. Warm fluid over cold fluid is unstable and overturns; cold over warm is stable and stratifies. This is why thermal stratification in a hot water tank can hold a layer of scalding water at the top while the bottom stays tepid, and why a thermometer reading taken from one spot may misrepresent the tank's average.

Misconceptions worth correcting

The first misconception is that density itself is a material property. It is a state property. Steel has a nominal density, but a specific steel at a specific temperature has a specific density, and the two differ. Reference tables usually state the temperature they assume, and ignoring that assumption is the most common source of a few-tenths-of-a-percent error.

The second is that "heat makes things expand" applies uniformly. It applies to most things, most of the time, with the 0 °C to 4 °C water window as the major exception and phase transitions as the minor ones. The rule is a tendency, not a law without conditions.

The third is confusing density with specific gravity or weight. Specific gravity is a ratio to a reference, usually water at a defined temperature, so the reference temperature matters as much as the sample temperature. An older hydrometer calibrated at 60 °F will read slightly differently against a modern 20 °C reference for the same fluid. The discrepancy is not the instrument being wrong; it is the reference being different.

The fourth is assuming gases behave as if temperature is the only variable. At the same temperature, pressure changes density by roughly 1 percent per 0.145 psi at sea level for air. A sealed gas container kept at constant pressure will shed density as it warms, but a rigid sealed container will instead see pressure rise. Which happens depends on the container, not the gas.

The fifth is the classic "hot water freezes faster" claim. The Mpemba effect is real enough to be interesting, but it is not a reliable or universal outcome, and it does not mean hot water is denser or colder. It is a supercooling, evaporation, and convection phenomenon. Anyone citing it as a contradiction of density behavior is mixing up thermodynamics with anecdote.

Practical actions and thresholds

If you work with fluids, treat temperature as a variable to measure, not a constant to assume. A few concrete practices go a long way.

For hydrometer and refractometer readings, record the sample temperature and the instrument's calibration temperature. Correcting is simple arithmetic; ignoring it introduces an error comparable to the instrument's own resolution. For air-handling or combustion systems, size fans and ducts for mass flow, not just volumetric flow. A system sized at 60 °F air will move about 9 percent less mass at 110 °F for the same fan volumetric flow. For stored liquids, never assume a tank is uniform. Sample temperature in at least two depths before measuring density or issuing a batch. Red flag: a density table spanning a phase transition. Verify the phase before interpolating. Red flag: reconciling a reading against a tabulated density without checking the table's stated temperature. This is the single most common source of a claim that a material "isn't the right density." Water-specific: if the application cares about the 4 °C maximum, verify the measurement temperature is above 4 °C before trusting a temperature correction. Below that point the sign of the correction flips.

For buying decisions, temperature behavior rarely changes price directly, but it does change specifications. A thermometer accurate over the working range is worth more than a precision hydrometer whose calibration temperature is unknown.

Limitations, and what temperature does not explain

Temperature is a powerful predictor of density for gases and a good one for most liquids and solids. It is not a complete one. Pressure, composition, dissolved gas, phase, and history all matter, and for some materials, temperature is the smaller effect.

Composition is the biggest rival for liquids. A 1 °C change in water density is about 0.02 to 0.03 percent, while adding 3 percent salt can raise its density by several percent. If a reading looks wrong and the fluid may be contaminated or mixed, do not correct the temperature—check the composition first.

For gases, pressure dominates at high pressures. At 10 atmospheres, a 10 °C change in air temperature moves density far less than a 1 percent change in pressure. For solids, manufacturing history matters: the same alloy, cold-worked or heat-treated differently, has different density and different expansion.

Finally, measurement uncertainty sets a floor on what any temperature correction can achieve. A typical industrial hydrometer has an uncertainty of a few tenths of a percent, which is the same order as a 1 °C to 2 °C temperature error in water. Correcting to more digits than the instrument can resolve is a false precision trap.

The honest limit: mechanisms explain direction and magnitude, and tables supply the specific numbers for specific materials. Neither replaces a measurement at the actual conditions.