Every atom has a tiny nucleus in its middle, with electrons moving in a fuzzy cloud around it. But the cloud is not a jumble. The electrons are arranged in layers, a bit like the layers of an onion.

These layers are called electron shells. They explain a lot: why some atoms join up eagerly, why others hardly ever do, and even where the colours of fireworks come from.

Layers around the nucleus

The electrons of an atom are not all the same distance from the nucleus. They sit in layers called shells. The first shell is closest to the nucleus, the second is further out, and the third is further still.

Each shell has room for only so many electrons:

  • The first shell holds up to 2.
  • The second shell holds up to 8.
  • The third shell takes 8 more before the fourth shell starts. (In heavier atoms, the third shell later makes room for even more.)

Electrons fill the shells from the inside out. The nucleus has a plus charge, and it pulls on the electrons, which have a minus charge. It pulls hardest on the closest ones, so the inner shells are the most settled places. An electron only goes further out when the inner shells are full.

Filling the shells, one element at a time

In the periodic table, each element has one more electron than the one before it. Watch how the shells fill:

ElementElectronsElectrons in each shell
hydrogen11
helium22
lithium32, 1
carbon62, 4
neon102, 8
sodium112, 8, 1
chlorine172, 8, 7
argon182, 8, 8
calcium202, 8, 8, 2

Read “2, 8, 1” like this: 2 electrons in the first shell, 8 in the second and 1 in the third.

The electron shells of carbon, neon, sodium and chlorine Four atoms, each a nucleus with rings for its electron shells and dots for its electrons. Carbon has 2 electrons in the first shell and 4 in the second, with 4 empty places. Neon has 2 and 8: its outer shell is full. Sodium has 2, 8 and a single electron in its third shell. Chlorine has 2, 8 and 7, one short of a full outer shell. In each atom, the outer shell is drawn in a stronger colour than the inner ones. carbon 2, 4 neon 2, 8: full sodium 2, 8, 1 chlorine 2, 8, 7
Four atoms and their shells. The outer shell, drawn in blue, is the part other atoms meet. Neon’s is full. Sodium has one lonely outer electron, and chlorine is one electron short of a full shell.

The outer shell is what counts

When two atoms meet, their outer shells touch first. So the electrons in the outer shell decide how an atom behaves. They are called outer electrons, or valence electrons.

An atom with a full outer shell is settled and calm. Helium, neon and argon have full outer shells, and they almost never join with other atoms. They are the noble gases.

Other atoms are not so settled. They can reach a full outer shell in different ways:

  • By giving electrons away. Sodium has only 1 outer electron, and it gives it away easily. Then the full shell underneath becomes its outer shell.
  • By taking electrons. Chlorine has 7 outer electrons, one short of 8. It grabs an extra electron whenever it can.
  • By sharing electrons. Carbon has 4 outer electrons. It shares them with other atoms, and each partner counts the shared electrons as its own.

An atom that has given away or taken electrons is called an ion. Shared electrons hold atoms together in chemical bonds, and that is how atoms join into molecules.

This is also the secret of the periodic table. Elements in the same column usually have the same number of outer electrons, so they behave alike.

Go deeper: Shells, subshells and orbitals for grown-ups and the extra curious

The simple rule “2, 8, 8” works for the first 20 elements. The full picture is richer.

  • Shell number nn can hold at most 2n22n^2 electrons: 2, 8, 18 and 32 for the first four shells.
  • Each shell is split into subshells named s, p, d and f, which hold 2, 6, 10 and 14 electrons. Shell 1 has only an s subshell. Shell 2 has s and p, so 2+6=82 + 6 = 8. Shell 3 has s, p and d, so 2+6+10=182 + 6 + 10 = 18.
  • Subshells fill in order of energy, and that is not always shell by shell. In potassium and calcium, the 4s subshell has less energy than 3d, so it fills first. That is why potassium is 2, 8, 8, 1 while its third shell still has room. From scandium to zinc, new electrons go into the 3d subshell, and zinc ends up as 2, 8, 18, 2.
  • Each subshell is made of orbitals, the cloud-like regions where an electron is likely to be found. One orbital holds at most two electrons, and they must have opposite spins. This rule is the Pauli exclusion principle.

Where do the colours of fireworks come from?

Electrons can do something amazing. An electron in an atom can only have certain amounts of energy, called energy levels. An atom can get a kick of energy, for example from the heat of a flame. Then one of its outer electrons can jump up to a higher energy level.

It doesn’t stay there for long. A moment later it falls back down and gives the extra energy away as a tiny flash of light.

How an electron makes a flash of light Two pictures of an atom, with three of its energy levels drawn as curved lines. In the first, heat lifts an electron from a lower energy level up to a higher one. In the second, the electron falls back down to the lower level, and a wavy arrow shows the light it gives out. 1. Heat kicks it up 2. Back down: light! heat energy levels light
Heat from a flame lifts an electron up to a higher energy level. When it falls back, it gives out the extra energy as a flash of light.

Different atoms have different steps, so they glow in different colours. Many metals give a flame their own colour:

ElementFlame colour
sodiumyellow
lithiumred
strontiumred
calciumorange-red
potassiumlilac
bariumgreen
copperblue-green

Firework makers use exactly this trick. They mix in strontium for red, barium for green, sodium for yellow and copper for blue. Old yellow street lamps glowed because of sodium, and neon signs glow red-orange because of neon.

Go deeper: Colour is energy for grown-ups and the extra curious

The energy of one flash of light, called a photon, depends on its colour: E=hfE = h f. Here EE is the photon’s energy, ff is the frequency of the light and hh is Planck’s constant, about 6.63×10−346.63 \times 10^{-34} joule-seconds. Of the colours we can see, red light has the lowest frequency and violet the highest.

Sodium’s famous yellow light has a wavelength of about 589 nanometres. Each of its photons carries about 2.1 electronvolts, which is exactly the drop between two of sodium’s energy levels. Both of these levels belong to the third shell: the outer electron jumps from the 3s subshell up to 3p and falls back. So a jump does not have to reach a new shell.

Every element has its own set of drops, so its light splits into a pattern of sharp coloured lines, like a barcode. Astronomers read these barcodes in starlight to find out what stars are made of. Helium was discovered this way. In 1868 it showed up as a yellow line in sunlight, 27 years before it was isolated on Earth. Its name comes from helios, the Greek word for the Sun.

Go deeper: Flame colours: atoms or molecules? for grown-ups and the extra curious

Sodium, lithium and potassium colour a flame as single atoms. Strontium, calcium, barium and copper mostly do it as part of small molecules that form in the flame, such as SrOH and SrCl, CaCl, BaCl and CuCl. These molecules give out most of the red, orange, green and blue light.

Their electrons follow the same rule: up to a higher energy level, then back down with a flash of light. But a molecule has many more levels, lying close together, so it gives out bands of colour instead of a few sharp lines. Firework makers add chlorine compounds on purpose, because they help the chlorides form and make the colours deeper.

Go deeper: Where the pictures go wrong for grown-ups and the extra curious

Shells are not solid rings, and electrons do not circle the nucleus like planets. That picture comes from Niels Bohr’s model of 1913, an important early step. Today, quantum physics describes each electron as spread out in an orbital around the nucleus. A shell is a group of orbitals with similar energies.

The staircase is the part of the picture that is right. An electron in an atom can only have certain exact energies, never anything in between. That is why an atom’s light comes in exact colours.

Check yourself

Neon has 10 electrons. How are they arranged?

Show the answer

2 in the first shell and 8 in the second — The first shell holds only 2. The other 8 go into the second shell, which is then full. That is why neon hardly ever reacts.

Check yourself

Why does a firework glow red?

Show the answer

Electrons in the strontium fall back to lower energy levels and give out red light — Heat lifts electrons in the strontium up to higher energy levels. When they fall back, they give out red light.