We use first-principles density functional theory total energy calculations based on pseudopotential and plane-wave basis to examine the energetics of the periodic structures with different stacking sequences in Mg–Zn–Y alloys. For pure Mg, we find that the 6-layer structure with the ABACAB stacking is the second most stable (among the 2-, 3-, 4- and 6-layer structures considered), after the lowest energy hcp structure with ABAB stacking. The addition of 2% Zn leads to stabilization of the structure to 6-layer sequence. The stacking fault energies in the 4- and 6-layer structures were found to be significantly higher than that in the 2-layer structure. Charge density analysis shows directional bonding and accumulation of charges in the basal plane of 4- and 6-layer structures.