We develop a genetic algorithm (GA) optimization method and use it in the design of a refractive-beam profile-shaping system. In this application, we employ the GA to determine the shape of one surface of the primary beam profile-shaping element in our system. The GA is instructed to vary the shape of this surface such that the output intensity profile is flat on a spherical surface some distance away. The GA does this while insuring that only a specified area of the output surface is illuminated. The calculation of the intensity profile is based on geometrical optics and is accomplished exclusively through ray tracing, giving this method broad applicability. © 1998 Optical Society of America.