Picture twilight in Los Angeles: the city's labyrinth of eight-lane freeways is jammed with millions of cars, engines burping pollutants into the air. The people in those cars may be drowning in a sea of smog, but they at least can take solace in seeing a scarlet sunset blazing across the horizon.

According to urban legend, air pollution enhances the beauty of a sunset. And pollution does indeed change the appearance of sundown, but whether it tips it in the direction of beauty is a matter of personal taste—and the overall amount of that pollution in the air.

Be it the azure of high noon or the orange glow of dusk, the colors of the sky result from sunlight interacting with molecules in the air, primarily nitrogen and oxygen, which cause it to be deflected in all directions, a phenomenon called Rayleigh scattering. All wavelengths of light are scattered, but they are not scattered equally. According to John W. S. Rayleigh's approximate scattering law, colors with shorter wavelengths are scattered the most: violet, followed by blue, then green, and so on.

During the day, when the sun is directly overhead, light travels only a short distance through a relatively thinner section of the atmosphere. But as the sun edges toward the horizon, the light must travel increasingly longer paths and is scattered by more air molecules. By the time it reaches the end of this journey (our eyes), "most of the blue has been scattered out of that beam" explains Stephen Corfidi, a meteorologist at the National Oceanic & Atmospheric Administration (NOAA). What remains are the warmer hues of yellow, orange and red, which blend into a yellowish-orange sunset.

Yet, scattering by nitrogen and oxygen can only explain how sunsets can be orange and perhaps reddish, not how the sky can blush blood red. "In an atmosphere with no junk at anytime, you'll never get a sunset that would make someone with normal color vision say, 'Wow that's red!'" says Craig Bohren, professor emeritus of meteorology at Pennsylvania State University. "It is certainly true that the 'pollution' results in redder sunsets."

To get a red sky, you need aerosols, explains A. R. Ravishankara, director of chemical sciences at the NOAA Earth System Research Laboratory in Boulder, Colo. Aerosols are solid or liquid particles suspended in the air that originate from both natural processes and human activity.

Natural aerosols come from forest fires, mineral dust kicked up by sandstorms, sea spray and volcanic eruptions, among other things. Volcanoes, which have produced some of the most spectacular sunsets in history, can inject sulfuric acid droplets into the stratosphere, the layer of the atmosphere between 10 to 35 miles in altitude. These droplets can be swept across the globe, painting brilliant crimson twilights wherever they go. Following the 1883 eruption of Indonesia's Krakatoa, brilliant sunsets appeared around the world, one of which is said to have inspired Norwegian artist Edvard Munch's painting, The Scream.

But "in a large city, you can ignore natural aerosol products for the most part" because the number of aerosols produced by human activity far exceeds natural sources, says Sergey Nizkorodov, a chemist at the University of California, Irvine. Human-generated aerosols can enter the atmosphere directly, as is the case with soot emitted by internal combustion engines in cars and trucks, he explains. Aerosols are also produced when molecules in the gaseous state enter the atmosphere and react with other chemicals, he adds. A classic case: burning fossil fuels releases sulfur dioxide gas into the air, which then turns into sulfuric acid aerosols.

Most particles suspended above cities scatter radiation, preferentially removing the cooler violets and blues in the spectral palette and enhancing the red, Nizkorodov says. In this sense, these particles scatter light much the same as do oxygen and nitrogen molecules.

"Molecules and small particles scatter the same way as long as the particle is sufficiently small," Bohren says. If the particle is small compared with the wavelengths of visible light, it will scatter short wavelengths, such as blues and violets, more than long wavelengths, such as red. Many man-made aerosols are small enough to meet this criterion, so they contribute to the deep crimson sunsets of Los Angeles and other polluted cities across the globe.

However, "at some point, the air pollution is so bad, and the sky is so saturated, you don't even see the sun clearly anymore," Nizkorodov says. For example, the sunset can appear bright but washed out when large numbers of big particles accumulate in the troposphere, the layer of the atmosphere closest to the ground. Aerosols that are close in size or larger than the wavelengths of visible light tend to scatter all colors indiscriminately, increasing the overall brightness of the sky but dampening color contrast.

"Particles of any kind, even much smaller than the wavelength of visible light, will, as a rule, make the sky brighter but at the expense of its purity of color," Bohren says, noting that the effect is more pronounced when there is a high concentration of large aerosols. So, although aerosols may make a sunset red, excess pollution will also dampen the overall sunset experience. In fact, the transition from day to night might be a whole lot peachier—and healthier—without all that atmospheric flotsam.