The compound formed between magnesium and chlorine is magnesium chloride MgCl2 . Magnesium chloride is a white or colorless crystalline solid.The electronic structure of magnesium and chlorine can help explain the formation of this compound. Magnesium has an electron configuration of [Ne] 3s2, meaning it has two electrons in its outermost shell. Chlorine has an electron configuration of [Ne] 3s2 3p5, meaning it has seven electrons in its outermost shell.In order to achieve a stable electron configuration, magnesium loses its two outermost electrons to form a Mg2+ ion, while chlorine gains one electron to form a Cl- ion. This process is called ionic bonding, and it results in the formation of magnesium chloride MgCl2 .The color of a compound is determined by the wavelengths of light that are absorbed or reflected by the compound. In the case of magnesium chloride, the ionic bonding between magnesium and chlorine does not result in any significant absorption of visible light, so the compound appears white or colorless.