The density of water is about : this relationship was originally used to define the gram. The density varies with temperature, but not linearly: as the temperature increases, the density rises to a peak at  and then decreases; the initial increase is unusual because most liquids undergo thermal expansion so that the density only decreases as a function of temperature. The increase observed for water from  to  and for a few other liquids is described as negative thermal expansion. Regular, hexagonal ice is also less dense than liquid water—upon freezing, the density of water decreases by about 9%.
These peculiar effects are due to the highly directional bonding of water molecules via the hydrogen bonds: ice and liquid water at low temperature have comparatively low-density, low-energy open lattice structures. The breaking of hydrogen bonds on melting with increasing temperature in the range 0–4 °C allows for a denser molecular packing in which some of the lattice cavities are filled by water molecules. Above 4 °C, however, thermal expansion becomes the dominant effect, and water near the boiling point (100 °C) is about 4% less dense than water at .
Under increasing pressure, ice undergoes a number of transitions to other polymorphs with higher density than liquid water, such as ice II, ice III, high-density amorphous ice (HDA), and very-high-density amorphous ice (VHDA).
The unusual density curve and lower density of ice than of water is essential for much of the life on earth—if water were most dense at the freezing point, then in winter the cooling at the surface would lead to convective mixing. Once 0 °C are reached, the water body would freeze from the bottom up, and all life in it would be killed. Furthermore, given that water is a good thermal insulator (due to its heat capacity), some frozen lakes might not completely thaw in summer. As it is, the inversion of the density curve leads to a stable layering for surface temperatures below 4 °C, and with the layer of ice that floats on top insulating the water below, even e.g., Lake Baikal in central Siberia freezes only to about 1 m thickness in winter. In general, for deep enough lakes, the temperature at the bottom stays constant at about 4 °C (39 °F) throughout the year (see diagram).