In a solution containing 10g/L NaOH and 12g/L phytic acid, anodic coatings were obtained by micro arc oxidation (MAO) on AZ91HP magnesium alloy. The morphology, structure and composition of anodic coatings were investigated by scanning electron microscope (SEM), X-ray diffraction (XRD) and energy dispersive X-ray (EDX). The corrosion resistance of magnesium alloy before and after MAO treatment was evaluated by immersion test and potentiodynamic polarization testing in 3.5wt. % NaCl solution. The coatings were evenly formed on the substrate and mainly composed of MgO. EDX analyses showed that phytic acid took part in the coating formation. Compared with the substrate, the corrosion resistance of magnesium alloy after MAO treatment was improved considerably.