Thin films of MoOx coated with platinum as a catalyst were prepared by dc magnetron sputtering from a molybdenum target in an oxygen and argon atmosphere. The films were colored and bleached by exposure to diluted hydrogen gas and air, respectively. In situ measurements of x-ray reflectance and substrate curvature were performed during switching cycles. Upon hydrogen exposure a remarkable thickness decrease of 11% and a density increase of 6.5% are observed by x-ray reflectance measurements. Corresponding changes in optical transmittance and mechanical stress up to several hundreds of MPa are also observed. These changes are not fully reversible as revealed by measurements of multiple switching cycles. Both the change of thickness and density, as well as the change of optical transmittance and mechanical stress can be explained by the existence of a mixed phase of edge and corner sharing MoO3 octahedra whereupon the first coloration the ratio between edge and corner sharing octahedra is changed. © 2004 American Institute of Physics.