ZnO thin films with different Mg contents were deposited onto quartz glass substrate by sol-gel spin coating method. XRD, SEM, UV-VIS and four-point probe meter were used to analysis the effects of Mg doping contents on structure and transparent conductive properties of the films. The results show that, ZnO thin films remain hexagonal wurtzite structure with c-axis as the preferential growth orientation after Mg doped. The crystalline quality get better then become worse, peak position of(002) shifts small angle direction before shifts high one and the grains are become bigger and more uniform and the surface of films are become more flat with the Mg content increasing. while the Mg content increases to 3 at%, the film surface appears clusters. Ultraviolet and visible light transmittance and band gap of the films can be improved by doped appropriate amount Mg, The best transmittance can reach 88.83%. However, when the Mg content reaches 3at%, the transmittance drops obviously for the effects of absorbing and scattering of increasing defects and clusters. The band gap of the films are widen first then narrowed and last widen again as a result of co-effects of the changes of defects band width and the Burstein-Moss effect, which cause by the metallic differences of Mg ion and Zn ion; the four-point probe reveals that Mg doping can lower surface resistance of the ZnO films.