* Magnesium (Mg) is in group 2 of the periodic table, meaning it loses 2 electrons to form a +2 cation (Mg²⁺).
* Chlorine (Cl) is in group 17, meaning it gains 1 electron to form a -1 anion (Cl⁻).
To form a neutral compound, you need to balance the charges. Since magnesium has a +2 charge, you need two chlorine ions (each with a -1 charge) to achieve a neutral compound.
Therefore, the formula becomes MgCl₂.