The proposed encoder in two dimensional photonic crystals is analyzed interms of flow of light inside waveguides. Waveguides have been created by removing silicon rods in the structure and defects with smaller radii have been created to achieve the proper couplers operations. The photonic band gap of the proposed encoder is determined and their performance is evaluated using finite difference time domain method. The proposed design has an optical output power threshold range between 76-94% for ON state and threshold level of OFF state is below 20%. The proposed encoder is operated in the wavelength of 1550 nm. Hence, it is applicable for high speed optical integrated circuit. The response time and contrast ratio calculated from the proposed encoder are 0.24 ps and 8.59 dB which are comparatively better than the literature reported with compare to footprint area of the proposed encoder.