Electrons are not scattered randomly around the nucleus. Each one has an "address" made of an energy level, a sub-level and an orbital. Writing that address down is called an electron configuration. It explains why elements in the same column of the periodic table behave alike, and it is the foundation for almost everything else in chemistry.
Explained simply
Think of the atom as a block of flats. The floors are main energy levels, numbered n=1,2,3 and so on. Higher floors are further from the nucleus and higher in energy.
Each floor is divided into types of flat called sub-levels, labelled s, p, d and f. Each sub-level contains a fixed number of rooms called orbitals. An orbital is a region of space where there is a high chance of finding an electron, and each one holds at most two electrons, which must have opposite spins.
Sub-level
Orbitals
Max electrons
s
1
2
p
3
6
d
5
10
f
7
14
s orbitals are spherical. p orbitals are dumbbell-shaped and point along the x, y and z axes.
Three rules decide how electrons move in:
Aufbau principle: fill the lowest energy orbitals first. The order is 1s, 2s, 2p, 3s, 3p, 4s, 3d, 4p. Notice that 4s fills 3d because it is slightly lower in energy at that stage.
Watch it explained
SPDF orbitals Explained - 4 Quantum Numbers, Electron Configuration, & Orbital Diagrams
The Organic Chemistry Tutor
How to Write the Electron Configuration for an Element in Each Block
Pauli exclusion principle: at most two electrons per orbital, with opposite spins.
Hund's rule: in a set of equal-energy orbitals, electrons spread out one per orbital before pairing up, like passengers on a bus who take empty seats before sitting next to a stranger.
How do we know energy levels are real? When atoms are heated, they give off light at only certain colours. This line spectrum appears because electrons drop between fixed levels, releasing a photon of a specific energy each time:
E=hf
The lines in hydrogen's spectrum get closer together at higher energy, because the energy levels themselves get closer together further from the nucleus.
Worked example
Write the full electron configuration of iron, Fe (26 electrons).
Fill in order: 1s22s22p63s23p6 uses 18 electrons.
Next comes 4s: 4s2 makes 20.
The remaining 6 go into 3d: 3d6.
Fe: 1s22s22p63s23p64s23d6
A shorthand uses the previous noble gas: [Ar]4s23d6. When iron forms Fe2+, it loses the two 4s electrons first, giving [Ar]3d6.
Orbital box diagram for iron arranged by energy: 1s, 2s, 2p, 3s, 3p and 4s are full, then the six 3d electrons fill one per orbital before pairing (one pair and four unpaired), giving [Ar] 4s² 3d⁶
Common mistakes
Removing 3d electrons first when forming ions. For transition metals, 4s electrons are lost first.
Forgetting the two exceptions. Chromium is [Ar]4s13d5 and copper is [Ar]4s13d10, because half-full and full d sub-levels are extra stable.
Pairing electrons too early in orbital diagrams. Use Hund's rule.
Confusing an orbital with a fixed orbit. An orbital is a probability cloud, not a planet-like path.
Where you see this in real life
Neon signs glow orange-red because excited neon electrons fall between specific levels. Fireworks get their colours the same way: strontium gives red, copper gives blue-green. Astronomers read the line spectra of starlight to find out which elements a star is made of, without ever going there.
2
3
p2
1s22s22p63p6
1s22s22p63s23p6
1s22s22p63s23p4
What is the electron configuration of Fe3+?
[Ar]3d5
[Ar]4s23d3
[Ar]4s13d4
[Ar]3d6
Why does an element produce a line spectrum rather than a continuous one?
The nucleus gives off light of one colour
Electrons can only have certain fixed energies
Electrons move in circular orbits at constant speed