Does more light from Andromeda get scattered in the atmosphere than in the entire trip to Earth? Fires have been burning here in Northern California. Today there was just a slight haze of smoke. The sun had a slight red hue to it. As expected the lower it got the redder it became. The blue light was filtered out by the earth’s atmosphere and the smoke. Yet, I can look at distant stars and even a galaxy (with a telescope) millions of light years away, and there appears to be no loss of blue light. 
I wonder if it's really possible that there is more stuff in Earth’s atmosphere than there is in all of the space between Earth and Andromeda. The galaxy is a fuzzy patch of whitish light indicating that all of the visible spectrum is making it through. Does that mean there is more “stuff” in our atmosphere than there is in the two million light years of space between Earth and Andromeda?
 A: Sure, let's do the order of magnitude calculation! According to Wikipedia:

In cool, dense regions of the ISM, matter is primarily in molecular form  and reaches number densities of $10^6$ molecules per $\text{cm}^3$. In hot, diffuse regions of the ISM, matter is primarily ionized, and the density is [$10^{−4}$ to $10^{-2}$] ions per $\text{cm}^3$. Compare this with a number density of roughly $10^{19}$ molecules per $\text{cm}^3$ for air at sea level.

The distance to Andromeda is $2.5 \times 10^6$ light years while the thickness of the Earth's atmosphere is on the order of $20$ kilometers. (It technically extends much higher, but the thickness decreases rapidly.) Then the ratio of the distances is
$$\frac{\text{Andromeda distance}}{\text{atmosphere height}} \sim 10^{18}.$$
At this point we would naively multiple this by the ratio of densities and call it a day, but it's crucial to account for the loss mechanism.


*

*The atmosphere mostly consists of $N_2$ and $O_2$, which perform Rayleigh scattering. This is the kind that occurs way more for blue light than red, explaining why the sky is blue and sunsets are red.

*Cool regions of the interstellar medium are mostly $H$ or $H_2$, and hydrogen just absorbs a few, discrete frequencies of visible light. These effects are important for astronomers, but not too important for the colors you see. That is, the cool regions don't matter, which is important for getting the right answer, because they're much denser than the hot regions!

*Hot regions of the interstellar medium are mostly ionized hydrogen. The dominant effect should be Thomson scattering off the free electrons.


Since only the hot regions matter, let's focus on those and suppose the whole line between the Earth and Andromeda is hot. Looking up standard numbers, for blue light we have
$$N_2 \text{ Rayleigh cross section} \sim 2 \times 10^{-26} \, \text{cm}^2$$
and the Thomson cross section is wavelength independent,
$$e^- \text{ Thomson cross section} \sim 7 \times 10^{-25} \, \text{cm}^2.$$
These are close enough that we can just neglect the difference, so we just need to compare the total distance and density. The ratio of the densities is about $10^{19}/10^{-3} = 10^{22}$, so we have
$$\frac{\text{ISM effect}}{\text{atmosphere effect}} \sim \frac{10^{18}}{10^{22}} \sim 10^{-4}.$$
It looks like all the space between us and Andromeda has less effect than the  atmosphere alone. 
Edit: as pointed out by Joshua (a real astrophysicist, unlike me, a regular physicist who just multiplied a bunch of powers of ten), the ISR is much sparser outside of galaxies, so I should have used the size of a galaxy rather than the full distance between galaxies. Also, a much larger effect comes from Rayleigh scattering off interstellar dust, which comes out to 20%. This is relatively close to the effect of the atmosphere.
