In this paper, gratings to apply for the optical interconnection are designed using a genetic algorithm (GA) for a robust and efficient schema. The real-time optical interconnection system architecture is composed with LC-SLM, CCD array detector, IBM-PC, He-Ne laser, and Fourier transform lens. A pixelated binary phase grating is displayed on LC-SLM and could interconnect incoming beams to desired output spots freely by real-time. So as to adapt a GA for finding near globally-cost solutions, a chromosome is coded as a binary integer of length 32 X 32, the stochastic tournament method for decreasing the stochastic sampling error is performed, and a single-point crossover having 16 X 16 block size is used. The characteristics on the several parameters are analyzed in the desired grating design. Firstly, as the analysis of the effect on the probability of crossover, a designed grating when the probability of crossover is 0.75 has a 74.7[%] high diffraction efficiency and a 1.73 X 10-1 uniformity quantitatively, where the probability of mutation is 0.001 and the population size is 300. Secondly, on the probability of mutation, a designed grating when the probability of mutation is 0.001 has a 74.4[%] high efficiency and a 1.61 X 10-1 uniformity quantitatively, where the probability of crossover is 1.0 and the population size is 300. Thirdly, on the population size, a designed grating when the population size is 300 and the generation is 400 has above 74[%] diffraction efficiency, where the probability of mutation is 0.001 and the probability of crossover is 1.0.