Ultra-fast and highly compact optoelectronic devices are highly needed for optical communication systems. One of the primary devices used in such systems is the optical encoder. In this paper, we present a 4x2 encoder realized using a new photonic crystal (PhC) ring resonator design. The proposed encoder consists of four inputs, two outputs, and two irregular hexagonal-shaped ring resonators. The structure is formed by silicon rods surrounded by air with square lattice pho-tonic crystal structure. The photonic band gap and performance parameters are analyzed using plane wave expansion (PWE) and Finite Difference Time (FDTD) methods. Our simulation results demonstrate that the normalized transmission values less than 25% and more significant than 50% are supposed to be logic states 0 and 1, respectively. The encoder’s maximum response time, contrast ratio, and footprint are 161fs, 13, 7dB, and 204.8µm2, respectively. Furthermore , the encoder can be used in optical systems with a bit rate of around 6.2Tbps, which is a very suitable device for high-speed networks.