Formation of Molecules
Atoms bond into molecules because a shared or transferred electron shell is energetically more favorable than each atom standing alone.
Why atoms bond
Only an atom's outermost electron shell — the valence shell — determines its chemical behavior. If it is completely filled, as with the noble gases helium, neon, or argon, the atom is unreactive and forms practically no bonds at all. Every other element "strives" to reach this same stable noble-gas configuration — the so-called octet rule: eight outer electrons (for hydrogen and helium, two are already enough).
To reach this goal, an atom has only one option: to share electrons with other atoms, or to give them up or take them on entirely. Which path is chosen depends mainly on electronegativity — a measure of how strongly an atom pulls electrons toward itself within a bond. The interplay of valence electrons, noble-gas configuration, and electronegativity gives rise to the entire system of chemical bonding.
Shell model: the first shell holds a maximum of 2 electrons, and every further shell up to the valence shell holds a maximum of 8 — only a full shell is stable.
Covalent, ionic, metallic
Depending on how similar two bonding partners are in electronegativity, one of three fundamental bond types emerges. The transitions between them are fluid — there is no sharp either-or, but rather a continuum.
Covalent bonding in detail
In a covalent bond, the electron clouds of two atoms overlap, and an electron pair preferentially resides between both nuclei — belonging, in a sense, to both atoms at once. Depending on how many electron pairs are shared this way, we speak of single, double, or triple bonds. More shared pairs mean a shorter and stronger, but also stiffer, bond.
From top to bottom, the number of shared electron pairs increases — the bond becomes shorter and stronger: H–H (436 kJ/mol) < O=O (498 kJ/mol) < N≡N (945 kJ/mol). In every case, the bond together with any lone pairs completely fills the valence shell of both atoms.
Ionic bonding: the example of table salt
Sodium has a single, loosely bound valence electron; chlorine is missing just one electron to complete its valence shell. Rather than sharing an electron pair, sodium gives up its valence electron entirely to chlorine. What remains are two charged particles: a positively charged sodium ion (Na⁺) and a negatively charged chloride ion (Cl⁻) — both now with a full noble-gas configuration. The electrostatic attraction between the opposite charges is the ionic bond itself.
Unlike a single molecule, countless Na⁺ and Cl⁻ ions in an ionic crystal such as table salt arrange themselves into a regular, three-dimensional lattice — which is why, strictly speaking, there is no such thing as "one NaCl molecule," only the ionic lattice as a whole.
Na⁺ + Cl⁻ → NaCl (ionic lattice)
From nonpolar molecule to ionic crystal
The three bond types are not sharply separated categories but rather endpoints of a spectrum, determined solely by the electronegativity difference Δ EN of the atoms involved. When Δ EN is near zero, both atoms share the electrons evenly (nonpolar covalent). As the difference grows, the electron density shifts noticeably toward the more electronegative partner (polar covalent) — until the difference becomes so large that a complete transfer is more favorable than a shared pair (ionic).
As a rule of thumb: Δ EN below ~0.5 is nonpolar covalent, up to ~1.7 is polar covalent, above that mostly ionic — the transitions are fluid.
The polarity of a bond determines how a molecule behaves: because of its polar O–H bonds and bent shape, water is an excellent solvent for salts — the foundation of nearly all chemistry in aqueous solution, from the cell to the ocean.