Sunlight looks white, but it’s really a mixture of every colour, from red, which has the longest wavelength we can see, through orange, yellow, green and blue, to violet, which has the shortest. You can see the mixture split apart in a rainbow or through a prism. What happens to that mixture on its way through the air is the whole story of the colour of the sky.
The air is made mostly of nitrogen and oxygen molecules, which are far smaller than the wavelength of visible light. When light meets something that small, a bit of it gets scattered, sent off in a new direction. The crucial detail, worked out by the physicist Lord Rayleigh in the 1870s, is that how much light is scattered depends very strongly on its wavelength. Shorter wavelengths are scattered far more, and the rule is steep: the amount scattered goes as one over the wavelength to the fourth power. Halve the wavelength and you get sixteen times as much scattering. Blue light, with a wavelength of around 450 billionths of a metre, against about 700 for red, is scattered roughly five or six times more.
Why should a tiny molecule care about wavelength at all? Light is a wave of electric and magnetic fields, and as it passes a molecule, its electric field pushes the molecule’s electrons back and forth, making them jiggle at the light’s own frequency. A jiggling charge sends out light of its own, in all directions: that re-sent light is the scattered light. And the faster a charge jiggles, the more strongly it radiates. Blue light has a higher frequency than red, so it shakes the electrons faster, and they throw out much more of it.
So as sunlight crosses the sky, the blue part keeps getting bounced around by the air, in every direction, while most of the red, orange and yellow passes straight through. Look at any part of the sky away from the Sun and you are seeing that scattered light, arriving from all over. It’s mostly blue. That’s why the sky is blue.
There’s an obvious question. If shorter wavelengths scatter even more, why isn’t the sky violet? There are a few reasons. Sunlight contains less violet than blue to begin with. Some of the violet is absorbed high in the atmosphere. And our eyes are much less sensitive to violet than to blue. Put it all together, and the sky we see is a pale, slightly whitish blue.
Now move the Sun down to the horizon. At noon its light comes down fairly directly through the atmosphere. At sunset, it comes in sideways, travelling through dozens of times more air before it reaches you. Along that long path, most of the blue is scattered away in other directions, much of it to light up the sky for people somewhere else. What’s left by the time the beam reaches your eyes is mostly the colours that scatter least: yellow, orange and red. The Sun looks orange, and so do the clouds it lights from below. Dust, smoke and tiny water droplets in the air can deepen the colours further, which is why some of the most dramatic sunsets come on hazy evenings.
The best way to check an explanation is to see whether it predicts something new, and this one does. On Mars, the atmosphere is very thin but full of fine reddish dust, and the dust particles are about the size of the wavelength of light, so they scatter differently from air molecules. The result is the reverse of Earth. Rovers have photographed a butterscotch daytime sky and, at sunset, a cold blue glow around the Sun.
The same rule explains why clouds are white. Cloud droplets are far bigger than air molecules, big enough to scatter every colour of light about equally. Mix every colour back together and you get white, or grey when a cloud is thick enough to block most of the light coming through it. And on the Moon, where there is no air to scatter anything, the sky stays black even at midday, with the Sun blazing in it.
It’s a lovely example of how one small, almost invisible effect can paint an entire planet. Every blue afternoon and every orange evening you’ve ever seen is the same rule, applied over a different length of air.