The electrons in an atom fill up its atomic orbitals according to the Aufbau Principle; "Aufbau," in German, means "building up." The Aufbau Principle prescribes a few simple rules to determine the order atomic orbitals are filled with electrons:
The outermost shell of an atom is its valence shell, and the electrons in the valence shell are valence electrons. Valence electrons are the highest energy electrons in an atom and are therefore the most reactive. While inner electrons (those not in the valence shell) typically don't participate in chemical bonding and reactions, valence electrons can be gained, lost, or shared to form chemical bonds. For this reason, elements with the same number of valence electrons tend to have similar chemical properties, since they tend to gain, lose, or share valence electrons in the same way. The Periodic Table was designed with this feature in mind. Each element has a number of valence electrons equal to its group number on the Periodic Table.
The electron configurations for the first and second row elements are shown in in simplified notation.
Our discussion of valence electron configurations leads us to one of the cardinal tenets of chemical bonding, the octet rule. The octet rule states that atoms become especially stable when their valence shells gain a full complement of valence electrons. For example, in above, Helium (He) and Neon (Ne) have outer valence shells that are completely filled, so neither has a tendency to gain or lose electrons. Therefore, Helium and Neon, two of the so-called Noble gases, exist in free atomic form and do not usually form chemical bonds with other atoms.
Most elements, however, do not have a full outer shell and are too unstable to exist as free atoms. Instead they seek to fill their outer electron shells by forming chemical bonds with other atoms and thereby attain Noble Gas configuration. An element will tend to take the shortest path to achieving Noble Gas configuration, whether that means gaining or losing one electron. For example, sodium, which has a single electron in its outer 3s orbital, can lose that electron to attain the electron configuration of neon. Chlorine, with seven valence electrons, can gain one electron to attain the configuration of argon. When two different elements have the same electron configuration, they are called isoelectronic.