Rhodamine B (RhB) was encapsulated into the SiO2 and Si-Ti binary oxide matrices by a sol-gel method. In the tetraethoxysilane (TEOS) system, the molecular structure of RhB changed from an open zwitterion to a lactone during the transition from sol to gel and from a lactone to a zwitterion during the gel to xerogel process. On the other hand, in a tetraethoxysilane-titanium isopropoxide (TEOS-TPOT) mixture, such changes in the molecular structure of RhB were not observed during the sol to gel to xerogel transitions. RhB encapsulated in the SiO2 matrices decomposed at 333 K under UV irradiation at wavelengths longer than 300 nm, whereas RhB encapsulated in the Si-Ti binary oxide matrices did not decompose and remained intact under the same UV irradiation.