How do rainbows form?
The short answer
Why does a rainbow only appear with the sun behind you, why is it round, and why is the sky inside it brighter? It all comes down to what light does inside a single raindrop, and one angle: 42 degrees.

A rainbow forms when sunlight enters raindrops, bends, bounces off the back of each drop and bends again on the way out, sending each colour back towards you at a slightly different angle: red at about 42 degrees from the point directly opposite the sun, violet at about 40. Every drop sitting at that angle from your line of sight lights up in one colour, and together they draw a circle around the shadow of your head.
That is the whole mechanism in one paragraph. The rest of this piece walks through it one step at a time, because each step explains something you may have noticed about rainbows without knowing why: why they only appear with the sun behind you, why they are round, why the sky inside the bow looks brighter, and why a second bow sometimes appears with its colours upside down.
Step 1: light bends going into the drop
Light travels more slowly in water than in air. When a ray of sunlight crosses into a raindrop at an angle, it changes direction. This bending is called refraction.
The amount of bending depends on the colour. Water slows violet light a little more than red, so violet bends a little more sharply. This difference is called dispersion, and it is the same effect that lets a glass prism spread white light into a band of colours. Sunlight looks white because it contains the whole spectrum at once; dispersion is what pulls it apart.
Step 2: the back of the drop acts like a mirror
The light crosses the drop and hits the far side. Most of it passes straight out of the back and is lost, as far as the rainbow is concerned. Some of it reflects off the inside surface and heads back the way it came.
Step 3: light bends again coming out
When the reflected light leaves the drop, it crosses from water to air and bends a second time, which spreads the colours further apart.

Here is the subtle part. Light hitting different parts of the drop comes out at different angles, anywhere from 0 to about 42 degrees from the direction it came from. But the angles bunch up at the top end. Rays striking a wide band of the drop all leave at close to 42 degrees, so the light returned at that angle is far brighter than at any other. That pile-up is what you see as the bow. Since the pile-up angle differs slightly for each colour (about 42 degrees for red, about 40 for violet), the colours land in separate stripes.
This also explains something people often notice and rarely hear explained: the sky inside a rainbow is brighter than the sky outside it. Drops inside the bow are still sending light back at smaller angles, with all the colours overlapping into whitish light. Outside 42 degrees, the drops send almost nothing back towards you.
Why the sun has to be behind you
Since the light comes back out of the drop roughly the way it went in, you only see it if you stand between the sun and the rain. Imagine a line from the sun, through the back of your head, and on into the ground ahead of you. Your shadow points along it. The point where that line would carry on, directly opposite the sun, is the centre of every rainbow you will ever see. Scientists call it the antisolar point.

Every drop that sits 42 degrees from that line, in any direction (up, left, right), sends red light to your eye. The set of all those drops forms a circle, which is why a rainbow is an arc of a circle and not a stripe or a smear. The ground normally hides the lower part of that circle. From an aircraft in flight, or looking down into the spray of a waterfall or a garden hose, you can sometimes see the whole ring.
The same geometry explains why rainbows show up mostly in the morning and late afternoon. The centre of the circle sits as far below the horizon as the sun is above it. Once the sun climbs higher than about 42 degrees, the top of the bow sinks below the horizon too, and there is nothing left to see against the sky. Around midday in summer, at many latitudes, that is exactly what happens.
It also means no two people see quite the same rainbow. Each of us gets light from our own set of drops, the ones at the right angle from our own eyes. Walk towards a rainbow and new drops take over the job, so the bow seems to move with you. You can never reach its end, because there is no fixed place where it is.
Where the second rainbow comes from
Sometimes a fainter, wider bow appears outside the first, with its colours in reverse order: red on the inside, violet on the outside. That secondary bow comes from light that reflects twice inside each drop before leaving. The extra bounce sends it out at roughly 50 to 53 degrees, so it sits about 10 degrees outside the main bow, and the extra reflection flips the order of the colours. Each bounce also lets light escape, which is why the second bow is always dimmer.
The band of sky between the two bows looks noticeably darker. Drops in that band send light back neither as part of the first bow nor the second. It is called Alexander's band, after Alexander of Aphrodisias, the Greek philosopher who described it around 200 AD.
Why the colours blend instead of seven stripes
A rainbow is a continuous spread of colour, not seven separate bands. The familiar list of red, orange, yellow, green, blue, indigo and violet comes from Isaac Newton, who chose to name seven colours partly by analogy with the seven notes of a musical scale. Look closely at a bright bow and you will see the colours shading into one another with no hard edges.
On some rainbows you can also spot narrow, pale pink and green stripes just inside the violet edge. These supernumerary bows cannot be explained by bending and bouncing alone. They come from interference: light waves that took slightly different paths through the drop reinforce each other in some directions and cancel in others, the same wave effect that noise-cancelling headphones put to work with sound. They show up best when the drops are small and all much the same size. Thomas Young used them in the early 1800s as evidence that light behaves as a wave.
A short history of figuring it out
People worked on this puzzle for a very long time. Aristotle wrote about rainbows, and Alexander of Aphrodisias noted the dark band. In the early 1300s Theodoric of Freiberg, working with water-filled glass spheres as model raindrops, showed that the bow comes from refraction and reflection inside individual drops. René Descartes worked out the 42-degree angle in 1637 by tracing the paths of rays through a drop, and Newton explained the colours later in the century, once he had shown that white light is a mixture.
The next time a shower passes and the sun comes out behind you, turn around and look for the bow. If you see it, look below it to your shadow: the centre of the circle is right there. And if you were wondering, lightning really can strike the same place twice, so admire it from somewhere sheltered.
Sources
- Raymond L. Lee Jr. and Alistair B. Fraser, The Rainbow Bridge: Rainbows in Art, Myth, and Science (Pennsylvania State University Press, 2001).
- René Descartes, Les Météores (1637), the discourse on the rainbow.
- Isaac Newton, Opticks (1704).