Sunlight looks white but contains every colour. When it enters the atmosphere it collides with air molecules, and those collisions scatter short wavelengths far more strongly than long ones. Blue is short. So blue light gets bounced around the sky and arrives at your eyes from every direction, while the red end travels through more or less undisturbed.
You are not looking at blue air. You are looking at sunlight that has been redirected towards you by the atmosphere, and the redirection is fussy about colour.
Scattering, not reflection
The effect is called Rayleigh scattering, after Lord Rayleigh, who worked it out in the 1870s. The strength of the scattering rises steeply as wavelength falls: roughly as the inverse fourth power.
That exponent is what makes the effect so pronounced. Blue light at around 450 nanometres is scattered something like five to six times more strongly than red light at around 700. A modest difference in wavelength produces a dramatic difference in how much of each colour is thrown sideways.
Crucially the air molecules are much smaller than the wavelength of light. That is the condition for Rayleigh scattering. Larger particles behave differently, which is the next section.
Why clouds are white and haze is grey
Cloud droplets are big compared with a wavelength of light. Big particles scatter all colours roughly equally, an effect called Mie scattering, so what comes out is white.
Same reason for fog, mist and the milky haze over a polluted city. Once the particles get large, the colour selectivity disappears and everything goes grey. This is also why an overcast day can still burn your skin: the cloud diffuses the light rather than removing the ultraviolet, which is one of the more expensive misunderstandings about what sunscreen numbers actually mean.
Why sunsets are red
Same physics, longer path.
At midday sunlight travels through a relatively thin slice of atmosphere to reach you. At sunset the sun is near the horizon and the light takes a long, shallow route through far more air. Over that distance almost all the blue has been scattered out of the beam before it arrives.
What is left is the long end: orange and red. A sunset is not the sky adding colour. It is the sky having subtracted the blue.
Midday and sunset are the same effect seen from two positions. At noon you are looking at the scattered light. At sunset you are looking at what survived the scattering.
This also explains why sunsets are more spectacular after a dust storm or a volcanic eruption. More particles, more removal, more of the red end left standing.
Then why is the sky not violet?
A fair objection. Violet has an even shorter wavelength than blue, so it should scatter more strongly still.
Two reasons it does not win. The sun emits less violet than blue to begin with, so there is less of it in the mix. And human eyes are considerably less sensitive to violet: the cone cells in your retina respond much more strongly around blue. The sky's true spectrum does peak below blue. What you perceive is the result after your own visual system has weighted it, and your visual system votes for blue.
Where the light came from in the first place
Worth stating, because it connects to the other half of the story. The sunlight being scattered was produced by hydrogen nuclei fusing into helium in the sun's core, releasing energy that takes a very long time to work its way out and then eight minutes to cross to us. The sun is a working fusion reactor, which is the reason people keep trying to build a small one on Earth.
Elsewhere in the solar system
The rule generalises, and it generalises in a satisfying way.
| Place | Daytime sky | Why |
|---|---|---|
| Earth | Blue | Molecular scattering in a clear atmosphere |
| Mars | Butterscotch | Thin atmosphere, dominated by suspended dust |
| The Moon | Black | No atmosphere, so nothing to scatter |
The lunar case is the clean confirmation. Astronauts standing in full sunlight looked up at a black sky with visible stars, because the sky's colour was never a property of the sky. It was a property of the air.
Incidentally the blue you see and the microwaves that heat your food are the same kind of thing, electromagnetic radiation, separated only by wavelength. The spectrum is one continuous ruler, and where you stand on it decides what the radiation does.
The short answer
The sky is blue because air scatters short wavelengths much harder than long ones, and blue is short enough to be thrown all over the sky while red is not. Remove the air and the effect goes with it.