If you look up at the sky on two random nights in the year, the color of the moon could be drastically different in your two viewings. This would be especially true if on one of those nights there happens to be a total lunar eclipse. But why does the moon turn red during an eclipse and why would it be any color other than its natural gray on an average day? The answer is in Earth’s atmosphere.

The sun sends light from across the electromagnetic spectrum to Earth, including the visible light that contains all the colors of the rainbow.

On top of visible light, there is X-ray, infrared, radio, gamma and ultraviolet light, but those are invisible to the human eye.

When that light reaches the Earth, the gas molecules and other particles in our atmosphere scatter it, meaning the light is absorbed by the atmosphere and radiated outward. More of the shorter wavelengths are scattered — on the bluer end of the visible light spectrum — than the longer wavelengths, which is why the sky appears blue.

And this is related to why the moon appears red when it’s obscured by the Earth, also known as a “blood moon.”

There is no direct light from the sun reaching the moon, which should throw it into shadow. But the Earth’s atmosphere is not some spherical brick wall that blocks visible light. So while the moon is in Earth’s shadow, light from the sun passes through our atmosphere and is refracted in the direction of the moon.

And just as our atmosphere scatters more of the shorter wavelengths so that we see a blue sky, the longer wavelengths like the reds and oranges pass through and those are the ones that make it to the moon — Earth’s atmosphere projects these longer wavelengths and bathes the moon in indirect reddish light.

During a total lunar eclipse, the Earth refracts reddish light toward the moon. NASA

The exact hue could vary based on things like temperature and humidity in the atmosphere, with those conditions sometimes making it more golden or copper in color and other times making it appear blood red.

This effect is similar to the effect we see during a sunset, when the sky is full of all sorts of red, pink and orange hues, instead of just blue.

“When we see a sunrise or sunset from our perspective on Earth, sunlight is coming in at a low angle,” NASA explains. “It has to travel through a lot of atmosphere, scattering more and more blue-colored light as it goes ... until what is left when the light reaches us at these day/night transition times is the more reddish wavelengths that get through.”

And that explains why the moon will sometimes look more orange or red even when there is no lunar eclipse — you’re seeing those colors when the moon is closer to the horizon.