Mg doped zinc tin oxide (ZTOMg) thin films were prepared on glasses by rf magnetron sputtering. O was introduced into the chamber during the sputtering. The optical properties of the films as a function of oxygen flow rate were studied. The crystal structure, elementary properties, and depth profiles of the films were investigated by X-ray diffraction (XRD), x-ray photoelectron spectroscopy (XPS), and secondary ion mass spectrometry (SIMS), respectively. Bottom-gate trdnsparent thin film transistors were fabricated on N Si wafers, and the variation of mobility, threshold voltage etc. with the oxygen flow rate were observed.