How much more atmosphere is the sun passing through at sunset as opposed to at its peak in the sky? I was looking at the sun during a sunset earlier today and wondered how much atmosphere you need to be able to look directly at the sun without damaging your eyes. The thought crossed my mind because I was continuously driving into an extremely oppressive sunset, my eyes were battered by the sun continuously for about a half an hour. Then, suddenly, the sun became more and more dull as it lowered into the sky. 

My question is: 

What is the approximate ratio of atmosphere between the sun and me, when setting as compared to when its positioned at a peak point in the sky? If you have the math behind an approximation like this from a topological observer, I would love to see that worked out.
The amount of atmosphere that light from outside Earth has to pass through before it reaches the ground is given by the air mass, $X$. It is normalized to unity for a source directly overhead (at "zenith"), and increases as the source "sets".

If you don't look too close to the horizon, you can use the formula $X = \sec z$, where $\sec \equiv 1/\cos$, and $z$ is the angle from zenith. For instance, if the Sun is $30^\circ$ above the horizon, so that $z=60^\circ$, then $X = 2$, i.e. its light passes through twice the amount of atmosphere compared to when its at zenith.

The formula above makes (at least) three approximations, however. Firstly, it assumes a plane-parallel atmosphere (an infinite, flat Earth), and so $X\rightarrow\infty$ as the Sun sets. Secondly, it assumes that the atmosphere is homogeneous, whereas in fact its density decreases with distance from Earth. This not only causes a non-uniform absorption$^\dagger$ along the ray, but also causes refraction which increases the path length for high $z$. For astronomers, these approximations don't matter much, since they're quite accurate out to $z\sim70^\circ \text{–}\,80^\circ$ and we usually don't observe at greater angles anyway, precisely because of the large air mass. But several more exact formulas based on various models of the atmosphere have been created to fit observed air masses. These models converge roughly to $X \simeq 38$ for $z=90^\circ$. In other words, the amount of atmosphere that light goes through for a source at the horizon, compared to a source at zenith, is roughly 38. However, note that just $10^\circ$ above the horizon, $X$ is already $&lt;6$, so it's the last few degrees that really matter.

The exact value depends on many factors, including temperature (and its change with height), position on Earth, and the altitude of the observer.



$^\dagger$Most photons are actually not absorbed, but rather scattered out of the line of sight. Effectively, the result is the same; photons are removed from the ray. The scattered photons then become part of the background (and since blue photons scatter more than red, the sky is blue, and the Sun becomes redder as it sets).