Chemicals form bonds to increase their stability. They do this by attempting to fill their outer energy levels with electrons. When sodium and chlorine bond together, for example, the sodium transfers one of its electrons to chlorine, filling the outer energy levels of both elements.
Chemicals form either covalent bonds or ionic bonds. Covalent bonds form when elements share their electrons, while ionic bonds form when ions with opposite charges are attracted to each other. Ions form when an element gains or loses electrons, leaving a particle that has either a positive or negative charge. Positively charged ions are called cations, while negatively charged ions are called anions.
When atoms bond together, they form molecules. If a molecule has at least two different elements, it is called a compound. Not all molecules are compounds, however, because it is possible for two atoms of the same element to bond together.