exupero's blog

Sunlight's distance through the atmosphere

Sunrises and sunsets are red because when we see the sun on the horizon, its light passes through more air than when the sun is directly overhead. How much air depends on its density at different altitudes, but since I only need a rough calculation, we'll use basic geometry and say the atmosphere ends at the Kármán line, 62 miles above sea level.

Figuring out the distance between an observer and the Kármán line over the horizon only requires two applications of the Pythagorean theorem:


For a six-foot observer at sea level, sunlight at sunrise and sunset passes through 706 miles of air, more than 11 times as much as when the sun is directly overhead.

To see the change in distance from overhead to horizon, we can use the law of cosines:

The change is essentially linear. If our model is accurate, that suggests the transition from blue noon to red sunset happens slowly throughout the afternoon, not in just the last hour or two of daylight, something like this:

A rapid fade from blue to brown doesn't match my experience of the of the color of the sky through the afternoon, so perhaps the atmosphere's pressure gradient makes more difference than a simple geometry accounts for, or maybe air's effect on sunlight's color isn't linear and a phase change happens at some point. (Or SVG color gradients don't transition the same way light does.) If you have any insight, please email me.