When pn junction is formed, then at the junction,free electrons from n-type diffuse over to ptype, and hole from p-type over to n-type. Due to this a layer of positive charge is built on n side and a layer of negative charge is built on p side of the pn junction.

This layer sufficiently grows up within a very short time of the junction being formed, preventing any further movement of charge carriers (electron and holes) across the pn junction.This space charge region, developed on either side of the junction is known as depletion region as the electrons and holes taking part in the initial movement across the junction deplete, this region of its free charges. Width of depletion region layer decreases when the junction is forward biased and increases when it is reverse biased.