A p–n junction is a boundary or interface between two types of semiconductor material, p-type and n-type, inside a single crystal of semiconductor. The "p" (positive) side contains an excess of holes, while the "n" (negative) side contains an excess of electrons. The p-n junction is created by doping, for example by ion implantation, diffusion of dopants, or by epitaxy (growing a layer of crystal doped with one type of dopant on top of a layer of crystal doped with another type of dopant). If two separate pieces of material were used, this would introduce a grain boundary between the semiconductors that would severely inhibit its utility by scattering the electrons and holes.
p–n junctions are elementary "building blocks" of most semiconductor electronic devices such as diodes, transistors, solar cells, LEDs, and integrated circuits; they are the active sites where the electronic action of the device takes place. For example, a common type of transistor, the bipolar junction transistor, consists of two p–n junctions in series, in the form n–p–n or p–n–p.
The invention of the p–n junction is usually attributed to American physicist Russell Ohl of Bell Laboratories. However, Vadim Lashkaryov reported discovery of p-n-junctions in CuO and silver sulphide photocells and selenium rectifiers in 1941.