The twinkling of stars is due to the atmospheric refraction of star's light. When the light from a star enters the earth's atmosphere, it undergoes refraction due to the varying optical densities of air at various altitudes. The continuously changing atmosphere refracts the light from the stars by different amounts from one moment to next. When the atmosphere refracts more light towards us, the star appears to be bright and when it refracts less star-light, then the star appears to be dim. In this way, the star light reaching our eyes increases and decreases continuously due to atmospheric refraction and the star appears to twinkle.