The electrons in an atom fill up its atomic orbitals according to the Aufbau Principle; "Aufbau," in German, means "building up." The Aufbau Principle, which incorporates the Pauli Exclusion Principle and Hund's Rule prescribes a few simple rules to determine the order in which electrons fill atomic orbitals:
The outermost orbital shell of an atom is called 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.
First, as electrons become higher in energy, a shift takes place. Up until now, we have said that as the principle quantum number, increases, so does the energy level of the orbital. And, as we stated above in the Aufbau principle, electrons fill lower energy orbitals before filling higher energy orbitals. However, the diagram above clearly shows that the 4s orbital is filled before the 3d orbital. In other words, once we get to principle quantum number 3, the highest subshells of the lower quantum numbers eclipse in energy the lowest subshells of higher quantum numbers: 3d is of higher energy than 4s.
Second, the above indicates a method of describing an element according to its electron configuration. As you move from left to right across the periodic table, the above diagram shows the order in which orbitals are filled. If we were the actually break down the above diagram into groups rather than the blocks we have, it would show how exactly how many electrons each element has. For example, the element of hydrogen, located in the uppermost left-hand corner of the periodic table, is described as 1s1, with the s describing which orbital contains electrons and the 1 describing how many electrons reside in that orbital. Lithium, which resides on the periodic table just below hydrogen, would be described as 1s22s1. The electron configurations of the first ten elements are shown below (note that the valence electrons are the electron in highest energy shell, not just the electrons in the highest energy subshell).
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 (Na), 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.