Laser hardening is a surface hardening process which enables high quality results due to the controllability of the energy input. The hardened area is determined by the heat distribution caused by the intensity profile of the laser beam. However, commonly used top-hat laser beams do not provide an ideal temperature profile. Therefore, in this paper the beam profile, and thus the temperature profile, is optimized using freeform optics. The intensity distribution is modified to generate a top-hat temperature profile on the surface. The results of laser hardening with the optimized distribution are thereupon compared with results using a top-hat intensity distribution.