Chemical bonds, which hold compounds together, are the interactions between the electrons of two or more atoms. An electron's atoms exist in layers or shells, and it is the electrons in the outermost layer that determine how the atom reacts. The ideal state for any atom is to have a full outer shell of electrons; atoms that already have a full outer shell are inert, meaning they do not react. Other atoms chemically bond by sharing, gaining or giving electrons to achieve a full outer shell.
A sharing, accepting or donation of electrons hold atoms together in a compound. Some atoms have no electrons to share or donate easily; these atoms do not readily react. Two common types of chemical bonds are ionic and covalent.
In ionic bonding, one atom gives up electrons while the other accepts them. Sodium chloride, or table salt, forms due to ionic bonds. Sodium contains a single electron while chlorine has seven. The easiest way for chlorine to obtain a full shell of eight electrons is to gain one electron, while it is easiest for sodium to lose its electron. When sodium loses one negatively charged electron, the atom gains a positive charge. Chlorine gains an electron and also a negative charge. The now oppositely charged atoms attract one another and form a bond.
In a covalent bond, the atoms share electrons. A simple example of covalent bonding is the hydrogen molecule, which consists of two hydrogen atoms. Each atom of hydrogen possesses a single electron; when two hydrogen atoms come together, they share electrons equally to form a bond.