Measuring the changing thickness of a thin film, without a reference, using an atomic force microscope (AFM) is problematic. Here, we report a method for measuring film thickness based on in situ monitoring of surface roughness of films as their thickness changes. For example, in situ AFM roughness measurements have been performed on alloy film electrodes on rigid substrates as they react with lithium electrochemically. The addition (or removal) of lithium to (or from) the alloy causes the latter to expand (or contract) reversibly in the direction perpendicular to the substrate and, in principle, the change in the overall height of these materials is directly proportional to the change in roughness. If the substrate on which the film is deposited is not perfectly smooth, a correction to the direct proportionality is needed and this is also discussed.