Atoms combine with one another through chemical bonds to form more stable arrangements. The two principal types of bonding are ionic and covalent. Ionic bonding occurs when a metal transfers one or more electrons to a nonmetal, creating positively and negatively charged ions, called cations and anions, which are then held together by electrostatic attraction. Covalent bonding, by contrast, involves the sharing of electrons between nonmetal atoms, allowing each atom to achieve a more stable electron configuration.
When two or more atoms join together through covalent bonds, they form a molecule, which represents the smallest unit of a covalent compound. The behavior of atoms in bonding is largely determined by their valence electrons, the electrons in the outermost electron shell. These are the electrons involved in forming chemical bonds, and the number of valence electrons an atom possesses dictates how it interacts with other atoms.
Chemists represent valence electrons visually using Lewis dot structures, which place dots around an atomic symbol to show both bonding and nonbonding, or lone pair, electrons. These diagrams make it possible to predict how atoms will connect, how many bonds a particular atom can form, and what the resulting molecule might look like. Together, ionic and covalent bonding explain the vast diversity of substances found in the natural world.