A rainbow is formed when sunlight interacts with raindrops. Sunlight is first refracted (bent) as it enters the water droplet. It is then internally reflected off the back inner surface of the droplet. Finally, it is refracted again as it exits the droplet. The different wavelengths (colors) of light are refracted at slightly different angles (dispersion), separating the white light into the spectrum of colors observed in a rainbow.