Sodium chloride is an ionic compound formed by the strong ionic attractions between positively charged sodium ions (which have lost one electron) and negatively charged chloride ions (which have gained an electron). These ions are held together in a giant ionic lattice.