Stars twinkle because light from stars is refracted as it passes through Earth's atmosphere, causing the star to appear to shift positions. Refraction is the redirection of light when passing between two different mediums, such as from space into the atmosphere. Snell's law describes the relationship between the angles of incidence and refraction based on the refractive indices of the two mediums the light is passing through.