The density of water is maximum at
Liquids generally expand on heating, but water is an exception.
Ice has a 3-D cage structure with vacant spaces in it. When it is heated from 0 °C, the water molecules start coming closer and filling these spaces.
This causes contraction in volume and hence the density increases.
This contraction continues till 4 °C where water achieves its maximum density.
Above 4 °C, liquid water molecules move apart causing expansion. And this expansion continues with further increase in temperature. Thereby, reducing the density.
This property of water is called anomalous expansion of water.
This is the reason why ice is less dense than water, and hence floats on it.