Points of Shimmering Light
On a clear night, the stars seem to sparkle and shimmer, flickering with a gentle, restless light. This twinkling is so familiar that it has inspired songs and poems for generations. But the stars themselves are not actually flickering. A star is an enormous, steadily glowing ball of hot gas, shining with a constant light. The twinkling we see is not happening at the star at all. It is happening much closer to home, in the air above us.
The Long Journey of Starlight
Stars are incredibly far away, so far that even the closest ones are unimaginably distant. The light from a star travels in a steady, straight beam across the vastness of space for years before it arrives at Earth. For almost all of that journey, nothing disturbs it. But in the final tiny stretch of its trip, the starlight has to pass through something that changes everything: the Earth's atmosphere, the layer of air surrounding our planet.
Air That Bends Light
The Earth's atmosphere is not perfectly still or uniform. It is made of layers of air with different temperatures and densities, and this air is always moving, swirling, and shifting because of winds and currents. When light passes through air, it bends slightly, an effect called refraction. Because the atmosphere is constantly changing, the starlight passing through it gets bent first one way, then another, moment by moment, in a random and shifting fashion.
Why It Looks Like Twinkling
A star is so far away that it appears as a tiny point of light, with no real size to our eyes. Because it is just a point, the constant bending of its light has a big effect: the light reaching our eyes seems to dance slightly and changes in brightness from instant to instant. We see this as twinkling. Interestingly, planets usually do not twinkle as much. They are much closer and appear as tiny disks rather than single points, so the bending of their light averages out and they shine more steadily.
Source
This article was written using information from Wikipedia.