Based on the principle of Fresnel diffraction and Gerchberg-Saxton algorithm, an effective method for designing binary optical diffractive elements (BODE) is presented. The objective light distribution, generated by a BODE designed by this method, is not sensitive to laser mode. A BODE, used in quenching treatment of CO2 laser, was designed and fabricated by photolithography and ion etching techniques. The element could transform a CO2 laser beam into rectangle beam shape with dimensions 12 mm×2 mm. The experimental results are satisfactory for the quenching treatment .