Magnesium and its alloys have a great potential for lightweight structure applications, because magnesium has lower density (~1.7 g.cm-3) compared to aluminum (2.7 g.cm-3) and iron (~7.9 g.cm-3). Magnesium alloys also exhibit high strength-to-weight ratios [1]. Their use enables the weight reduction of automotive and aerospace vehicles for more energy consumption efficient. However, magnesium alloys have a limitation for practical application, namely the high chemical activity, porous corrosion product and high corrosion rate. In addition, due to the rapid industrialization in some developing countries, air pollution (like PM2.5) has become a hot topic. Most of air pollutants contain ions like SO4 2-, NO3- and NH4+, which have high solubility [2]. The corrosion behavior of magnesium in chloride-containing environment is also worth studying because Cl- is the most common aggressive corrosion species. In contrast, sulfate ions in chloride-containing solutions can inhibit hydrogen evolution [3]. It is thus of great interest to understand the corrosion behavior of magnesium alloys in solution containing different anions, which provides a basis for designing the effective conversion coating process.In this study, the corrosion behavior of magnesium alloy AZ31B in sulfate and chloride solutions was investigated by using real-time imaging, hydrogen evolution test, electrochemical analysis, and cross-sectional TEM characterization. Through the results of the real-time imaging, the corrosion behavior of magnesium alloy AZ31B in the solution can be roughly divided into three stages. Firstly, the uniform corrosion proceeds with a large amount of hydrogen evolution. Secondly, the corrosion product gets thicker accompanied by the reduction in the amount of hydrogen evolution. Final stage only happens in the chloride containing solution. A hydrogen stream and dark corrosion products are produced [4]. Cross-sectional TEM was employed to characterize the sample, which was immersed for 25 min (the time when the dark corrosion product was produced). The results show that when the magnesium alloy AZ31B was treated in the chloride solution, the thickness of the corrosion product layer is about 80 ± 30 nm. Furthermore, the corrosion product layer formed in a sulfate-containing solution shows a uniform film thickness about 170 nm. This difference in thickness was further confirmed in the hydrogen evolution test. The hydrogen evolution test shows that the amount of hydrogen produced by the magnesium alloy AZ31B in the sulfate solution is about twice that in the chloride solution. This indicates that the corrosion product formed in the sulfate solution is about twice that in the chloride solution, implying that the corrosion product formed in the chloride ion environment is more protective. The EIS results also show the same trend. The total impedance of the corrosion product in the chloride ion immersion environment is much larger than that of the sulfate solution and the total impedance value increases as the chloride concentration is increased. As a result, chloride ions can effectively fill the weaker areas of the airform film during the early stages of corrosion. This localized corrosion phenomenon also causes the difference in film thickness.The third stage of corrosion was found to be absent when the magnesium alloy AZ31B was immersed in a chloride and sulfate mixture solution. The TEM results show that the corrosion product is more uniform than immersed in solution containing only chloride. Thus, it is proposed that sulfate ions serve as a physical barrier to hinder chlorine ions from attacking the magnesium substrate, which, in turn, results in a uniform corrosion product layer.