The short answer is rayleigh scattering, but let’s take the scenic route to answer this question.
Before explaining why the sky is blue we must talk first about the nature of light.
Light is made up of tiny little particles called photons, which travel as waves. To make this concept a bit clearer, try to picture the ocean. Can you see how it moves? Well, water is made up of tiny particles called molecules, and as the water moves up and down you can see the ocean move as waves. The distance between two peaks of a wave is called wavelength, and our eyes detect light over a range of wavelengths between 400 and 700 nanometres (a nanometre is a billionth of a metre). We perceive the different wavelengths as colours.
We must now ask you, what colour is the Sun?
If you answered yellow you would actually be wrong. Look at a photo of an astronaut in orbit around the Earth or standing on our moon. The light illuminating them isn’t yellow, it’s white, and that’s because the Sun is actually white –our brightest star appears yellow for the same reason why the sky is blue.
Now that you know the Sun is white, we also need to inform you that it doesn’t actually emit any white photons, as there is no such thing as white photons.
White light is just a mixture of all the colours, which means the Sun does actually emit yellow light, but also all the other colours of the rainbow. When all the colours are mixed together, our eyes interpret the colour as white light. Rainbows are made by the rain drops splitting the white light from the sun into all of the base colours. The colours are ordered according to their wavelength from red (longest wavelength), through orange, yellow, green, blue, indigo and violet (shortest wavelength).
When the Sun’s light travels through the air in the atmosphere it gets scattered (or dispersed) by the air particles. How much the light is scattered depends on the wavelength of the light. The air particles seem a lot bigger to the shorter wavelength light, and as such the colours down the violet end of the spectrum get scattered more than the hues up the longer wavelength red end of the spectrum.
All this scattering means the purple, blue and green photons that come from the Sun are spread across the sky, which when mixed together our eyes interpret at blue, while a much greater percentage of the yellow, orange and red photons stay on a straight path from the Sun—which, as explained before, our eye interpreted as yellow.
At sunset the sunlight has to pass through a lot more atmosphere, which causes the light to scattered more that is does during the day. This is why the Sun appears red at sunset.
Got a science question? Ask our Resident Scientist