The inorganic compound formed between magnesium and chlorine is magnesium chloride MgCl2 . This compound is an ionic compound, as it is formed by the transfer of electrons between a metal magnesium and a non-metal chlorine . Magnesium loses two electrons to form a Mg2+ ion, while each chlorine atom gains one electron to form Cl- ions. The resulting compound has a 1:2 ratio of magnesium to chlorine ions, hence the formula MgCl2.