Look up on a clear afternoon and the sky is a flawless, endless blue. But sunlight isn't blue, it's white, a blend of every color of the rainbow. So where does all that blue come from, and why does the very same sky catch fire in orange and red a few hours later at sunset?
The short answer
The sky is blue because air scatters blue light far more strongly than red light. Sunlight hits the gas molecules in our atmosphere, and those molecules fling blue wavelengths out in every direction. That scattered blue light reaches your eyes from all across the sky, so the whole dome looks blue. The effect has a name: Rayleigh scattering.
The real explanation
Start with the light itself. What we call white sunlight is actually a mix of all visible colors, each traveling as a wave. Red light has a long, lazy wavelength. Blue and violet light have short, tight wavelengths. That difference in size is the key to everything.
Now send that light into the atmosphere. The air is mostly nitrogen and oxygen molecules, and they are tiny, much smaller than the wavelength of visible light. When light waves run into particles this small, something specific happens: the shorter the wavelength, the more violently it gets scattered. Blue light, with its short wavelength, gets bounced around roughly ten times more than red light.
Here's the part that makes it click. The red and yellow light from the sun mostly sails straight through the air to your eyes, which is why the sun itself looks pale yellow-white. But the blue light doesn't travel in a straight line, it ricochets off molecule after molecule, scattering sideways, downward, every which way. By the time it reaches you, that blue light is arriving from every patch of sky at once. You're not looking at the sun's blue light; you're looking at blue light that has been scattered across the entire sky and redirected into your eyes.
So the blue you see isn't painted onto the sky. It's sunlight that took a detour.
Then why isn't the sky violet?
Good catch, violet light has an even shorter wavelength than blue, so it actually scatters more. By the logic above, the sky should look purple. Three things conspire to keep it blue instead. The sun puts out less violet light to begin with. Some of that violet gets absorbed high in the upper atmosphere. And, crucially, your eyes contain color receptors that are far more sensitive to blue than to violet. Add it all up and your brain reports "blue."
Why sunsets turn red
Now for the second half of the magic. At noon, the sun is overhead and its light punches through a relatively thin slice of atmosphere to reach you. But at sunset, the sun sits low on the horizon, and its light has to travel through a much thicker, longer stretch of air, sometimes dozens of times more.
Over that long journey, nearly all the blue light gets scattered away long before it arrives. What's left to reach your eyes is the light that resists scattering: the reds, oranges, and golds. They pass through the thick air and flood the sky near the horizon. That's why a sunset glows warm even though it's the exact same sunlight that looked blue at midday. The only thing that changed was how much air it had to cross.
It also explains why sunsets get especially vivid when there's dust, smoke, or pollution in the air, or after a volcanic eruption. Extra particles scatter even more of the short wavelengths, deepening the reds.
The part that'll stay with you
The blue of the sky and the red of a sunset are the same phenomenon, just seen from different angles through different amounts of air. And the effect reaches beyond Earth. On Mars, where the thin atmosphere is full of fine reddish dust, the physics flips: the daytime sky is a dusty butterscotch color, and Martian sunsets glow an eerie blue, the mirror image of ours. Same sunlight, different air, opposite sky. The color overhead is really a report on the planet you're standing on.
The bottom line
The sky is blue because tiny air molecules scatter short-wavelength blue light across the whole sky, sending it to your eyes from every direction, while longer-wavelength red light mostly travels straight through. At sunset, the light crosses so much more air that the blue is scattered away entirely, leaving the warm colors behind. Nothing in the sky is actually colored, you're watching sunlight bend, bounce, and sort itself by wavelength.
Keep wondering: if scattering decides what color the sky is, it also helps explain why stars twinkle but planets don't, and how your brain turns raw light into the vivid world you see when you dream.

