In this present work, photonic crystal based ultra-high-speed encoder is proposed for optical computing applications. The designed logic device contains dual nanocavity coupled ring resonator, reflector and five waveguides in a square lattice with barium titanate rods arranged in a nanostructure platform. The encoding device is working based on the interference and resonance effect. The photonic band diagram and performance characteristics of the encoder, namely, bit rate, ON–OFF ratio and delay time are analyzed by using a plane wave expansion and finite difference time domain methods. The simulation results show that the designed encoder is capable of functioning four logic states precisely. Furthermore, the presented device has numerous advantages such as low power consumption, high data rate and a very low footprint. The response time and total chip area of the proposed encoder are 369.3 fs and 13.2 μm × 13.2 μm, respectively. Hence, this simple nano-logic platform is extremely suitable for photonic logic processors.