When light passes from denser medium to rarer medium it bends away from the normal. When it passes from rarer medium to denser medium it bends towards the normal. This phenomenon of bending of light is called refraction of light.
Have you ever seen a coin placed at the bottom of a tumbler filled with water? The coin appears at smaller depth as its actual depth. Why does it happen? We see an image where the light rays meet or at the point where light seems to be coming from. When light comes out from water, it bends due to which the coin appears vertically displaced.
Does it always happen? No, it does happen only when light passes from one medium to another obliquely. The bending of light depends upon the density of the medium.
When light travels from one medium to another, its speed changes. A ray of light from a rarer medium to a denser medium slows down and bends towards the normal. On the other hand, the ray of light going from a denser medium to a rarer medium is speeded up and bends away from the normal.
It shows that the speed of light in different medium varies. Different medium have different abilities to bend or refract light. This bending ability of a medium is known as the index of refraction or refractive index. It is defined as the ratio of the speed of light in vacuum to that in the material medium.
n ≈ (speed of light in vacuum) / (speed of light in medium)