Definition
The octet rule says an atom becomes stable when its outermost shell holds eight electrons. When atoms bond, they often give, take, or share electrons until those eight seats are filled. It's a basic tool for guessing which atoms will pair up in a chemical bond.
A Bench with Eight Seats, All Full
Picture a long bench with eight seats. People stop shuffling around only when every seat is taken. Atoms work a bit like that. The outermost layer of an atom has seats for electrons, and the atom is calmest when all eight are filled.
Think of gases like neon and argon. They hardly mix with anything or react. Their eight outer seats are already full, so they have nothing to gain and nothing to give away.
But an atom with one seat empty, or with just one lonely electron out there, is restless. Sodium, one half of table salt, has only one outer electron, and it wants to hand that one off. Chlorine has one empty seat, and it wants to take one in.
When the two meet, the one that's short and the one that has extra fit together perfectly. That's how you can make a good guess about which atoms will bond and how.
Give and Take, or Share
There are two main ways to fill the eight seats. One is to hand electrons over completely. When sodium passes one electron to chlorine, sodium's outer shell is empty, and the inner shell, which already held eight electrons, becomes its new outer shell. Chlorine fills its empty seat and ends up with eight outer electrons.
Sodium, having given up an electron, becomes positively charged. Chlorine, having taken one, becomes negatively charged. Opposite charges stick together like magnets and form a salt crystal. This kind of bond is called an ionic bond.
The other way is to share electrons. In a water molecule, oxygen and hydrogen put some electrons in the middle and use them together. When both atoms count a shared pair as their own, both sides end up with full seats.
This kind of sharing bond is called a covalent bond. Whether atoms trade or share, the result looks similar: the outer seats add up to eight.
A Bit More Precisely
To be more precise, the number eight doesn't work everywhere. Hydrogen and helium have only two outer seats to begin with, so two electrons is plenty. That's why hydrogen in water is happy with two electrons.
The metals in the middle of the periodic table are a different story too. Their electrons have more complicated places to go, so eight doesn't fit neatly. Some atoms, like boron, finish bonding with just six. Others, like phosphorus and sulfur, are known to go beyond eight.
So the octet rule is less a law nature must obey and more a rule of thumb that works in many cases. Bonds actually form because the total energy drops when atoms come together, and eight seats is a shape that shows up often as a result. In reality, electrons aren't particles sitting in assigned seats. They spread around the nucleus like a cloud.
The eight-seat picture is a handy tool that makes bonds easy to count. If you know how far the tool works, chemistry gets much clearer.
Common misconceptions
The octet rule is a law of nature that applies to every atom without exception.
Hydrogen and helium are stable with two electrons, and metals in the middle of the periodic table often don't fit eight. It's closer to a rule of thumb that works well in many cases.
Electrons sit one by one in eight seats around an atom.
Electrons aren't particles sitting in seats. They spread around the nucleus like a cloud. The eight seats are just a picture that makes counting bonds easier.
Where you meet it
Table salt is what you get when sodium hands one electron to chlorine, leaving both atoms with eight outer electrons.
Helium in a balloon doesn't react even when it mixes with other gases. It has only two outer seats, so two electrons already fill it up. It's the classic exception to the eight-electron rule.
In one sentence
The octet rule is a rule of thumb: when atoms bond by trading or sharing electrons, their outermost electron seats often end up numbering eight.