A rainbow is nature’s way of splitting sunlight into a spectrum, and it all comes down to how light behaves inside countless raindrops. Sunlight looks white, but it actually contains many colors, each with a slightly different wavelength. When that white light enters a spherical raindrop, three key things happen in sequence: refraction, reflection, and refraction again on the way out.

First, refraction bends the light as it passes from air into water. Because different colors bend by different amounts—a property called dispersion—the colors begin to spread apart. Violet (shorter wavelength) bends more than red (longer wavelength), so the colors fan out inside the drop.

Next, the light reflects off the back of the drop like a tiny mirror. Finally, it refracts once more as it exits the drop and re-enters the air. This double bending plus one reflection sends the light toward your eyes at a very specific angle. For the primary rainbow, the brightest arc we usually see, red light exits at about 42° from the direction opposite the Sun (the “antisolar” point), with violet a bit lower. Because only drops positioned at just the right angle send you that color, each point on the arc comes from a different set of raindrops. In other words, you don’t see “one” rainbow—millions of drops each contribute a tiny piece.

Sometimes a secondary rainbow appears above the primary. It forms when light reflects twice inside the drop before exiting. The second reflection flips the color order and spreads the light more, so the secondary bow is dimmer and appears at a larger angle (around the low 50s degrees), with red on the inner edge and violet on the outer.

The shape and texture of the rainbow carry extra clues. The arc is part of a full circle centered on the antisolar point; the ground just hides the lower half. Close to the primary bow, you might notice a brighter inside region and a darker band between the two bows (Alexander’s band), a result of how many paths light can take through a drop. Under the right conditions with very uniform, small droplets, faint pastel supernumerary arcs can ripple inside the primary—an interference effect where light waves add and cancel.

So, a rainbow is simply sunlight, precisely sorted by water droplets, revealed when the Sun is behind you and rain is ahead. Physics never looked so colorful.