Rayleigh scattering occurs when sunlight interacts with the gas molecules in Earth's atmosphere, such as nitrogen and oxygen. Because blue light travels in smaller, shorter waves, it gets scattered in all directions much more than other colors, making the sky look blue.