In the present work, a high-speed optical encoder is proposed based on two-dimensional photonic crystal ring resonator using coupled mode theory and resonance effect. Square-shaped ring resonator, couplings rods, and several waveguides have been utilized in the proposed structure. Silicon rods in air structure have been designed with rod radius of 0.1a and lattice constant ‘a’ as 540 nm. The photonic band gap is being calculated using plane wave expansion method and finite-difference-time-domain method to analyze the performance characteristics of optical encoder like transmission spectra, electric field view, contrast ratio, response time, etc. The operating wavelength of structure is 1550 nm, to perform encoder operation where only one input port is activated at a time while other input ports are inactivated, and accordingly equivalent binary encoded signal is produced at output ports. The proposed encoder is designed with fast response time 222.76 fs, high data rate of 4.48 Tbps, and ultra-compact size of 140.84 µm2. Hence the proposed device is suitable for high-speed optical computation as photonic integrated circuit.