A quantum key distribution encoding device comprises a polarization interferometer, a first phase modulator, a second phase modulator and a polarization beam splitting module, and a port a of the polarization beam splitting module is an input port of the encoding device; a port b of the polarization beam splitting module and a port A of the polarization interferometer are respectively connected with an input port of the first phase modulator and an output port of the first phase modulator, and a port c of the polarization beam splitting module and a port B of the polarization interferometer are respectively connected with an input port of the second phase modulator and an output port of the second phase modulator to form a Sagnac ring. Compared with the prior art, six polarization states can be stably prepared, multiple lasers are not needed, safety loopholes caused by inconsistent wavelengths of the multiple lasers are eliminated, the prepared polarization states are very stable, any compensation is not needed, a receiving end only needs two single-photon detectors, and the complexity and cost of the system are reduced. In addition, the polarization coding device can be used for realizing a BB84 protocol, a 6-state protocol and a reference system independent protocol.