At night when you look up to the sky, if you try to focus on a star you might see it twinkling or flashing. This is called “stellar scintillation”. We can see up to 6,000 stars at night with the naked eye.
Stars twinkle because we are viewing them through Earth’s atmosphere, which has lots of thick, moving air in it. The light is refracted (bent) through the atmosphere, in lots of different directions, which causes the appearance of twinkling.
This light refraction also makes the twinkling appear as if the colours of the star light are changing. Light is composed of a spectrum of colours (red, orange, yellow, green, blue, indigo, violet), and this includes starlight.
Light travels in ‘waves’, and different frequencies of the waves produce different colours. Because the light is being bent at so many different angles, and travelling at different speeds when it passes through Earth’s atmosphere, it causes many different wave patterns in the light. This causes the twinkling of the star to be multicoloured!
You can see this refraction at home by shining light through a prism. The light slows down or speeds up as it travels through the prism at different angles, and produces a rainbow!
Figure 1: A prism and different light frequencies. Image credit: NASA (public domain).
Planets do not usually appear to twinkle, because they are much closer to Earth than the stars. The stars are very far away points of light (like our sun), that are travelling very far through space. The planets have a more stable image because the light that we can see coming off them is reflected from our own sun, and is much closer!
Stars that are closer to the horizon appear to twinkle more than stars that are high up in the sky. This is because there is more atmosphere between you and a star on the horizon, than you and a star in the sky.
If we were in outer space, stars would not twinkle, because the light coming off them would not be warped by any atmosphere. This is one of the reasons why the Hubble Space Telescope is so effective - it is already in space, so it can get much clearer pictures of the stars, and can see galaxies that are billions of light-years away.
Some other telescopes here on Earth can see the stars without the twinkling, by using complex mirrors that are constantly moving. The mirrors try to reflect the light from the star into a consistent beam, and combat the effect of the turbulence in Earth’s atmosphere. This is called adaptive optics, and is very useful for astronomers to more clearly view stars from Earth. The Hubble Space Telescope is much better … but very expensive!