Aiming at the problem of optimal welding path of welding robots, an developed whale optimization algorithm is proposed. In this paper, the layout of 14 welding spots is analyzed and simplified as Traveling Salesman Problem (TSP). The mathematical models of welding path optimization are established. On the basis of analyzing the principle of whale optimization algorithm, WOA searching flow is redesigned and searching ability is enhanced. Experiments of 5 testing functions indicate that the developed WOA has advantages (GSWOA), such as greater global searching ability, higher optimizing accuracy and so on. The sequence of welding path points is taken as the search agent of WOA and the shortest path distance is taken as the fitness function so that the developed WOA has been used in path planning of robots. Matlab software is employed to realize the simulation experiment of path planning. The simulation results show that the developed WOA can significantly shorten the welding distance and enhance the production efficiency.