Chlorine has seven valence electrons. These seven electrons make chlorine a very reactive element. Chlorine, like the other elements belonging to the halogen family of the periodic table, grabs an electron from another element to form a compound.
Chlorine is an extremely electronegative element, meaning it has a great attraction for electrons. In observance of the octet rule, chlorine needs to gain one electron to attain the full complement of eight electrons, a highly stable state for atoms. By gaining the single electron, chlorine takes on a negative charge, but it becomes more stable.
Chlorine, because of its high reactivity, reacts readily with many other elements, especially with metals, which tend to lose their electrons easily. Chlorine naturally forms compounds with alkali metals, which all have a single valence electron. The alkali metals donate their single valence electron to the halogens to form stable ionic compounds.