Magnesium and magnesium alloys are light-weighting candidates as the structure materials. The microstructure and corrosion behavior of 4,6 all in wt%) alloys were studied. The results showed that the morphology, size and distribution of Mg 17 Al 12 phase were gradually improved with the increasing of Er content, and a large number of Al 2 Er were observed. The Al 2 Er inhibited the hydrogen evolution reaction and promoted the growth of passivation film. Er oxides or hydroxides were found on the surface of the passivation film, and the charge transfer resistance of the film was 4447 Ω•cm 2 , while the film resistance was 5852 Ω•cm 2 , which reduced the electron transfer efficiency and improved the density and stability of the passivation film, thus greatly improving the corrosion resistance. As Er content reaches 6 wt%, the corrosion rate decreases by nearly 45 %.