Stars twinkle because of the Earth's atmosphere. When starlight enters the Earth's atmosphere, it passes through layers of varying temperature and density, causing the light to refract or bend. This bending of light makes the stars appear to twinkle when we observe them from Earth.