What happens to the density of a substance as it is heated?
Density is the ratio of mass to the volume of a substance. In other words,
density = mass / volume
Since the units of mass are g or kg and those of volume are mL, L, cm^3 or m^3; the commonly used units of density are g/mL, kg/L, g/cm^3, kg/m^3, etc.
When we heat a substance, its molecules gain kinetic energy and move faster. Depending on the amount of heat provided, these molecules may also be able to overcome the intermolecular forces and thus move more freely. When this happens, the state of the substance may change from solid to liquid or liquid to gas. Since liquids occupy more volume compared to solids and gases occupy more volume as compared to liquids, heating a substance increases its volume. This is the reason we say substances expand on heating. Since the mass stays the same, the ratio of mass to the volume decreases. In other words the density of the substance decreases as it is heated.
Water is an exception: when water goes from the solid to liquid state, its density increases.
Hope this helps.