Abstract The study presents the results of tests of electrochemical corrosion of AZ31 alloy after casting and metal forming in NaCl solutions. These alloys featured various concentrations of chlorine ions. The tests were carried out in 0.01, 0.2, 0.6, 1.0 and 2.0 M NaCl. System for electrochemical tests VoltaLab®PGP201 was applied. Potentiodynamic tests enabled to register anodic polarisation curves. Stern method was applied to determine parameters typical of corrosion resistance of the alloy. Results showed that corrosion resistance of AZ31 magnesium alloy decrease with increasing of chlorine ions concentration (irrespective of using alloy state). The corrosion resistance of alloy after forming is mildly worse than alloy after die- casting.