The paper presents a methodology of optimization of the gating system for sand casting using the genetic algorithm. Software package for computer-aided design/computer-aided manufacturing (CAD/CAM) was used as the support to the design and verification of the optimized gating system. The geometry of the gating system of sand casting in excavator tooth holder was the subject of optimization. The objective was to maximize filling rate given the constraints posed by both the ingate module and Reynolds number. Mold filling time has been presented as a function of the ingate cross section and casting height. Given the conditions above, as the result of the optimization, a complete geometry of the gating system has been defined. Numerical simulation (software MAGMA 5) has been used to verify the validity of the optimized geometry of the gating system.