An original technology of zinc diffusion into InP via a narrow gap is described, which allows reproducible formation of p–n junctions with preset depth of doping and retained surface morphology of the doped layers. Using the proposed method, desired charge carrier distribution profiles in Zn-doped InP layers were obtained. It has been experimentally confirmed that the method of cross-sectional scanning electron microscopy allows to precision measure of the zinc diffusion depth.