TiO2 films were prepared on the AZ31 Mg alloy substrate by sol-gel method. The morphology was characterized via X-ray diffractometer (XRD), scanning electron microscopy (SEM) and energy disperses spectroscopy (EDS). The corrosion rate of the coated AZ31 mg alloy was tested with the method of orthogonal experiment design. The influence of the hydrolysis temperature, coating times, calcinations temperature and time was investigated.