The function of electrolyte components of microarc oxidation for magnesium alloy was discussed using single factor method. The optimal formula was obtained as follows: 10 g/L (NaPO3)6, 5 g/L NH4F, 6 g/L KOH, 6 mL/L C3H8O3. The surface and cross section morphology of the coating was observed by SEM. The phase structure and element distribution were analyzed by XRD and EDS. The corrosion resistance of the coating was determined by dropping test, ac impedance spectroscopy and salt-spray test. The results showe...