At noon the sky is blue. At sunset the western horizon glows orange and red. It looks like two different effects, but it is one effect seen from two angles: air knocks blue light sideways far more readily than red.

Drag the Sun ↕
Sun height
40°
Air crossed
1.6×
Sunlight is
white
Blue 450 nm
80% Green 550 nm
90% Red 700 nm
96%
A simple physics model of clean air: sunlight is thinned by Rayleigh scattering on the way in, and the sky's colour is the light scattered towards you. The bars show how much of each colour of the direct sunbeam survives the trip.

1Air is a very weak blue filter

Sunlight arrives as a mix of every colour, which our eyes read as white. On its way down it passes nitrogen and oxygen molecules, each far smaller than a wavelength of light. When a light wave passes such a molecule, it shakes the molecule's electrons, and the shaking electrons re-emit a little of that light in new directions. That is scattering.

The strength of this scattering depends steeply on wavelength: it goes as 1 / wavelength⁴. Lord Rayleigh worked this out in 1871, which is why it carries his name. Because of that fourth power, blue light at 450 nm is scattered about six times more strongly than red light at 700 nm (700 ÷ 450 = 1.56, and 1.56⁴ ≈ 5.9). Violet at 400 nm is scattered roughly nine times more than red.

2Why the sky above you is blue

Look at any patch of sky away from the Sun. No sunlight is aimed at you from there, so what you see is only light that air molecules have bounced sideways into your eye. Since blue is bounced far more than red, that sideways light is heavy on blue. Every direction you look, you see the same thing: a glow of scattered, mostly blue sunlight.

The effect is weak per molecule, which is why a room full of air does not look blue. You need kilometres of it. Straight up, the atmosphere is thick enough that roughly a fifth of the blue in the direct sunbeam gets scattered out along the way, while only a few percent of the red does.

3So why isn't it violet?

If short wavelengths win, the sky should be violet. Three things stop that. The Sun puts out less violet than blue. Some violet is absorbed high in the atmosphere. And our eyes are much less sensitive to violet. The scattered light is really a broad mix leaning towards short wavelengths, and our three types of colour cone read that mix as a pale sky blue.

4Sunset: the same light, a longer road

you noon: short path sunset: ~38× more air air Earth (air layer drawn far thicker than real)

At noon the sunbeam takes the short way down. When the Sun sits on the horizon, the beam skims sideways through the atmosphere instead. At sea level that slanted path crosses about 38 times as much air as the path straight overhead.

Along that long road, the blue gets scattered out of the beam again and again until almost none is left. Scattered blue is not destroyed: it lights up the sky for someone else, further along. What still reaches you in a straight line is the light that air is bad at scattering: yellow, orange and red. In the model above, at the horizon about a quarter of the red in the direct beam survives, while the blue drops to a tiny fraction of one percent.

Drag the Sun down in the simulation and watch the bars. Blue collapses first, then green, and the disc turns from white to yellow to deep orange. The sky around it warms too, because the light doing the scattering there has already lost its blue.

5Dust changes the rules

Rayleigh's rule only holds for scatterers much smaller than the wavelength. Haze, smoke droplets and dust grains are closer in size to the wavelength, and they scatter all colours much more evenly. Press Add haze and the noon sky turns paler and whiter, the way it looks on a humid summer afternoon, and the setting Sun gets dimmer and redder.

Mars shows the extreme case. Its thin air is full of fine dust, and its daytime sky looks yellowish-brown rather than blue. At sunset it flips: NASA rovers such as Spirit and Curiosity have photographed a blue glow around the setting Sun, because Martian dust grains happen to be the right size to let blue light through more efficiently and keep it concentrated near the Sun.

One idea, two views: looking away from the Sun you see the blue that air throws sideways; looking at the setting Sun you see what is left after the blue has been thrown out.