Atoms combine together when the outermost shell, or valence shell, of electrons is not filled with two electrons (if there is only one shell) or eight electrons (if it has more than one shell). Atoms combine to fill the outermost shell and become stable compounds by either losing electrons to become ions or gaining electrons. Atoms can combine with similar elements or different elements.
Atoms are composed of protons, neutrons, and electrons. While protons and neutrons are held in the nucleus and have a consistent value, electrons circle the atom in shells and atoms can add or lose electrons if necessary. The first shell, which is closest to the nucleus, holds only two electrons in its orbit. Other shells can hold eight electrons in orbit. The shell closest to the nucleus is filled first, then the next, and so on until there are no more electrons to use. The atom never creates more shells than necessary to house the orbiting atoms. The outermost shell, called the valence shell, must be complete in order to be stable. However, atoms often do not have enough electrons to fill the outermost shell. Therefore, the atom pairs with other atoms to fill this outermost shell. The paired atom can be the same element, a different element or several different elements.