The presence of Mg addition in bath has been shown to improve the corrosion resistance of the hot-dip Al-Zn alloy coating while adhesion of coating degrades. And the underlying mechanism of the additive effects was not very clear. In this work, first-principles method has been used to investigate the effect of Mg addition on thickness of Galvalume coating. The optimized geometric configurations, total energy and electronic charge distributions for the Mg substitution in Fe2Al5 and FeAl3 phases were obtained. And results indicated that the most favorable sites for Mg substitution in both Fe2Al5 and FeAl3 phases are Al positions. Bonding energy and charge density results show that the addition Mg could not form Mg-Al bond and has little effect on the thickness of alloy layer.