Why is the sky blue and the sunset red?
The sky is blue because air molecules scatter short wavelengths far more than long ones, roughly as 1 ÷ wavelength⁴: blue light at 450 nm is scattered 4.5 times more than red at 650 nm, so blue reaches your eye from every direction. Sunsets are red for the same reason seen from the other side: a low Sun shines through up to 38 times more air, the blue is scattered out of the direct beam on the way, and what is left is orange and red.
The simulation computes this rather than painting it. Each patch of the sky is a ray traced through a model atmosphere, adding up sunlight scattered by molecules (Rayleigh scattering) and by haze, dust or smoke (aerosol), with the light dimmed along both legs of the trip. The Sun disc takes the colour of whatever survives the direct path. Move the Sun from midday to sunset, add smoke, then switch to Mars, where the same physics with different particles gives a blue sunset. Our post on why the sky is blue and not violet covers the colour vision side.
Key results from the simulation
- Blue scatters 4.5 times more than red: the whole atmosphere's Rayleigh optical depth is 0.221 at 450 nm and 0.049 at 650 nm (Hansen and Travis 1974).
- The path length does the rest: air mass is 1 overhead, 2.0 with the Sun 30 degrees up, 10 at 5 degrees and 38 on the horizon (Kasten and Young 1989).
- Golden hour strips the blue: with the Sun 6 degrees up only 4.1% of the blue in the direct beam gets through, against 26% of the red, and the Sun computes to #FFBE61.
- Smoke and dust deepen sunsets: with a haze optical depth of 0.7 and the Sun 2 degrees up, the Sun turns #FF0300, almost pure red, and the sky near the horizon goes #FF1200.
- Mars flips it: at midday the dusty Martian sky computes to #FFDEBC, butterscotch, while at sunset the sky right next to the Sun turns #DBE8FF, blue.
From midday to a Martian sunset
Each scene gives the numbers the simulation shows, explains what you would see, and has a button that loads it. Haze is set as the aerosol optical depth at 550 nm: about 0.05 is very clean air, 0.1 an ordinary clear day, 0.5 and above heavy haze, smoke or dust.
Midday: blue sky, nearly white Sun
Sun 55 degrees upWith the Sun 55 degrees up the light crosses 1.2 air masses. The direct beam keeps 67% of its blue and 85% of its red, so the Sun stays close to white (#FFEAD3). The scattered light is another matter: molecules send 4.5 times more blue than red sideways, so the sky overhead computes to #C7DAFF.
Take the haze out completely and the zenith deepens to #93BBFF. Ordinary haze scatters all colours nearly equally and mostly forwards, which is why the sky whitens around the Sun and toward the horizon on a muggy day. Above the clouds, in an aircraft, the sky is noticeably deeper blue for the same reason.
Golden hour: the blue is gone from the beam
Sun 6 degrees upAt 6 degrees the sunlight crosses 8.8 air masses, the equivalent of 75 km of air at sea level density. The blue in the direct beam is down to 4.1% while the red keeps 26%, so the Sun computes to #FFBE61 and everything it lights turns warm. That is the light photographers wait for.
Overhead the sky is still blue (#C4E0FF), because the light scattered down from above crossed much less air. In the afternoon scene, with the Sun 20 degrees up, the blue in the beam is still 39%.
Sunset: 31 air masses of red
Sun half a degree upWith the Sun's centre half a degree above the horizon the air mass is 31. The Rayleigh optical depth at 450 nm times that path is about 6.9, which leaves e to the minus 6.9 of the blue: effectively none. The Sun computes to #FF4E00, deep orange, and only 0.012% of its visible brightness reaches you, which is why you can glance at a setting Sun.
The sky near the Sun glows #FF7800: this is sunlight that has already lost its blue, scattered once more toward you by the air and haze low down. Higher up the sky stays blue grey, partly because ozone absorbs orange light in the Chappuis band. The red Sun is also lifted and flattened by refraction, the effect behind the green flash, which this model leaves out.
Related reading: What causes the green flash at sunset?
Smoke, dust and pollution: a blood red Sun
Haze optical depth 0.7Raise the haze slider to 0.7, a smoky or dusty day, and set the Sun 2 degrees up. Haze particles add their own extinction, and because they sit in the lowest kilometre or two, a low Sun's path through them is extremely long. The beam keeps under 0.001% of its red and much less of everything else, so the Sun computes to #FF0300, close to pure red, dim enough to stare at.
This is why wildfire smoke and dust storms produce red suns even at midday, and why sunsets after big volcanic eruptions are famous. Particles from smoke are small enough to scatter blue somewhat more than red (the model uses an Angstrom exponent of 1.3), so they redden the beam further. Haze also whitens the sky overhead to #E8F5FF.
Mars at midday: a butterscotch sky
Dust optical depth 0.5Mars has a surface pressure of about 6 millibars, under 1% of Earth's. Its carbon dioxide scatters more per molecule than air, but there is so little of it that the Rayleigh optical depth is only about 0.0025, against 0.097 on Earth. Molecules hardly colour the Martian sky at all.
Dust does. The fine iron oxide grains, typically a micrometre or two across, are far bigger than molecules and scatter all colours fairly evenly, but they absorb some blue. The result is a sky of #FFDEBC, the butterscotch seen in rover images. The Sun itself stays close to white (#FFF1E8). For more on Martian weather, see our post on Mars dust storms.
Mars sunset: why it is blue
Sun 2 degrees upNASA's Curiosity rover photographed this in Gale Crater in April 2015. The dust grains are the right size that blue light, scattered by them, stays in a narrower cone around the Sun's direction than red light does. Looking toward the setting Sun through 16 air masses of dusty air, you see that concentrated blue glow, #DBE8FF in the simulation, while the rest of the sky stays #FFDBBA.
The model gets this from a forward scattering lobe whose width follows the diffraction angle of 1.5 micrometre grains, about wavelength ÷ 3 µm radians: roughly 9 degrees for blue and 13 for red. It is tuned to the physics, not fitted to rover data, so treat the exact colour as illustrative.
Related reading: Why are sunsets red, and Mars sunsets blue?
Sun altitude, air mass and the colour of the Sun
| Sun altitude | Air mass | Blue (450 nm) through | Red (650 nm) through | Sun colour |
|---|---|---|---|---|
| 90° | 1.0 | 70% | 86% | #FFEBD6 |
| 60° | 1.2 | 67% | 84% | #FFEAD3 |
| 30° | 2.0 | 49% | 74% | #FFE6C4 |
| 20° | 2.9 | 36% | 65% | #FFE0B4 |
| 10° | 5.6 | 14% | 43% | #FFD18B |
| 5° | 10 | 2.3% | 20% | #FFB54F |
| 2° | 19 | 0.041% | 3.6% | #FF8700 |
| 0° | 38 | under 0.001% | 0.003% | #FF2700 |
Earth, ordinary clear day (haze optical depth 0.1 at 550 nm), ozone 300 Dobson units. Transmission is for the direct beam only. Colours are CIE 1931 converted to sRGB, brightness normalised.
How the simulation works
Sunlight arrives as a 5,772 K blackbody spectrum, a close stand-in for the real solar spectrum, split into 19 bands from 380 to 740 nm. Air scatters it with the Rayleigh optical depth of Hansen and Travis (1974), τ = 0.008569 λ⁻⁴ (1 + 0.0113 λ⁻² + 0.00013 λ⁻⁴) with λ in micrometres, which is 0.097 at 550 nm. Haze follows the Angstrom law, τ = τ550 (λ ÷ 550 nm)^−1.3, with a Henyey-Greenstein phase function (asymmetry 0.7) and 92% of its extinction as scattering. Ozone absorbs in the Chappuis band, with an optical depth of 0.042 at 603 nm for 300 Dobson units.
For the direct Sun, each band is dimmed by e^(−τm). The air mass m for the molecules is the Kasten and Young (1989) formula, m = 1 ÷ (cos z + 0.50572 (96.07995° − z)^−1.6364) with z the Sun's zenith angle, which gives 38 at the horizon. Haze, being concentrated in the lowest 1.2 km, uses the air mass of a spherical shell of that thickness.
For the sky, each of about 780 patches is a ray marched outward through a spherical atmosphere (molecule scale height 8.5 km, haze 1.2 km). At each step the code adds sunlight scattered toward you, weighted by the phase functions, and dims it on the way in from the Sun and on the way out to you. That is single scattering. The spectrum is converted to a colour with the CIE 1931 colour matching functions, exposed like a camera set for the typical patch of sky, and given a modest saturation lift for display. The land is lit by the computed sunlight and skylight.
Mars uses the same code with a 3,390 km planet, an 11 km scale height, CO2 scattering scaled from Earth by its column of molecules, and dust with no wavelength dependence of extinction, a single scattering albedo that falls toward blue, and a forward lobe that is narrower for blue than for red.
What the model leaves out
- Multiple scattering: light scattered twice or more brightens the sky near the horizon and in twilight. The model counts one scattering, so low sky and twilight scenes come out a little dark.
- Refraction: the air bends the setting Sun upward by about half a degree and squashes it. The model draws the Sun at its true altitude. See the green flash post.
- The real solar spectrum: sunlight above the atmosphere has absorption lines and is a little short of violet compared with a 5,772 K blackbody. Colours shift slightly as a result.
- Clouds, water vapour and oxygen bands: clouds are not modelled, and the weak water and oxygen absorption bands in the red are left out.
- Your eyes adapt: the exposure mimics a camera. In real twilight your eyes switch toward rod vision and the sky looks bluer and dimmer than any screen shows.
- Mars dust details: the dust optical properties are simplified and tuned to reproduce the observed blue aureole, not fitted to measured scattering data.
Common misconceptions
"The sky is blue because it reflects the ocean." No. The sky is just as blue over deserts, and the ocean is partly blue because it reflects the sky. The blue comes from molecules scattering sunlight.
"Sunsets are red because of pollution." Clean air alone makes a red sunset: with the haze slider at 0, the Sun on the horizon still computes to a deep orange because of 38 air masses of Rayleigh scattering. Smoke and dust make it deeper and redder.
"Blue light is absorbed by the air." Mostly it is scattered, not absorbed. The blue removed from the setting Sun is the blue of someone else’s afternoon sky further west.
Frequently asked questions
Why is the sky blue?
Air molecules are much smaller than the wavelength of light, and particles that small scatter light roughly as 1 ÷ wavelength⁴. Blue at 450 nm is scattered about 4.5 times more than red at 650 nm, so scattered blue light reaches your eye from every part of the sky.
Why are sunsets red and orange?
Near the horizon sunlight crosses up to 38 times more air than when the Sun is overhead. Along that path most of the blue is scattered out of the beam. With the Sun 6 degrees up only 4.1% of the blue gets through against 26% of the red, and at the horizon almost only red and orange remain.
Why are sunsets on Mars blue?
Martian dust grains, around 1.5 micrometres across, scatter blue light into a narrower cone around the Sun than red light. Looking toward the setting Sun through a long dusty path you see that blue glow, while the rest of the sky stays butterscotch. NASA’s Curiosity rover photographed it in 2015.
Why is the sky white near the horizon?
Looking toward the horizon you look through much more air and haze. The blue is scattered toward you, but also scattered away again, and haze adds light of all colours. The mix tends toward white. Haze and humidity make it much stronger.
Why are sunsets redder after wildfires or volcanic eruptions?
Smoke and volcanic aerosol add extinction on top of the air, and they sit low or spread widely. With the haze slider at 0.7 and the Sun 2 degrees up, the simulated Sun turns #FF0300, close to pure red.
Is the sky blue on other planets?
It depends on the particles. Mars has butterscotch skies and blue sunsets because of its dust. Titan has an orange haze. A planet with a thick, clean nitrogen atmosphere would have a blue sky like ours.
Keep learning
Why Are Sunsets Red, and Why Are Mars Sunsets Blue?
A setting Sun shines through 38 times more air, which strips out 99.98% of its blue. On Mars, dust does the opposite. The physics and the numbers.
Why Is the Sky Blue and Not Violet? The Full Answer
Skylight carries more violet than blue, yet the sky looks blue. We compute the scattered spectrum and run it through human cone data to show why.
What Causes the Green Flash at Sunset? The Numbers
Every sunset has a green rim, but it is 4 to 8 times too thin to see. We compute the refraction and dispersion, and show why mirages make the flash visible.
What Color Is the Sun Really? White, and Here's Why
The Sun is white: a 5772 K spectrum excites all three cone types almost equally. Why it peaks near green but never looks green, and why it turns orange.
Could a Mars Dust Storm Knock Over a Rocket? The Physics
A 100 km/h Martian storm pushes like a 12 km/h breeze on Earth. We run the tipping math for a 50 m rocket and find what Mars dust really threatens.