When these atoms react together Calcium chloride, CaCl2, is formed. Calcium atoms have two electrons in their outer shell, which can be determined from the fact they are in group 2 of the periodic table. Chloride atoms have seven electrons in their outer shell, which can be determined from the fact they are in group 7 of the periodic table. So to reach the optimum state of a full outer shell of electrons (or no outer shell) calcium needs to lose two electrons and chlorine needs to gain 1. Therefore one electron from the calcium atom is transferred to a chlorine atom and the other electron from the calcium atom is transferred to a second chlorine atom. So calcium loses two electrons forming a Ca2+ ion and two chlorine atoms gain one electron each forming 2 Cl- ions.