The results of optimization and testing of an electron gun (EG) with an off-axis cathode position are presented. The EG can be used as an injector for different types of electron accelerators. The main goal of the optimization is a search for degrees of freedom in the geometry of the gun electrodes that allow designing of diode guns with different values of the beam perveance.