The Mg x Zn 1-x O thin films with the various content ratio ranging from 0 to 0.4 were prepared by sol-gel spincoating method. To investigate the effects of content ratio on the structural and optical properties of the Mg x Zn 1-x O thin films, scanning electron microscopy (SEM), X-ray diffraction (XRD), and photoluminescence (PL) were carried out. With increase in the content ratio, the grain size of the Mg x Zn 1-x O thin films was increased, however, at the content ratio above 0.2, MgO particles with cubic structure were formed on the surface of the Mg x Zn 1-x O thin films, indicating that the Mg content exceeded its solubility limit in the thin films. The residual stress of the Mg x Zn 1-x O thin films is increased with increase in the Mg mole fraction. In the PL investigations, the bandgap and the activation energy of the Mg x Zn 1-x O thin films was increased with the Mg mole fraction.