Sodium chloride forms an ionic bond, between metallic sodium and non-metallic chlorine. An atom of sodium transfers an electron to an atom of chlorine, forming a positive sodium ion and a negative chlorine ion. The bonding in HCl is covalent. A covalent bond is formed between two non-metals and involves the sharing of electrons. The bonding in magnesium is metallic, forming giant structures consisting of atoms arranged in regular patterns. The positive metal ions are surrounded by a sea of delocalised electrons which are free to move through the metal.