Abstract Planning collision-free and smooth joint motion is crucial in robotic applications, such as welding, milling, and laser cutting. Kinematic redundancy exists when a six-axis industrial robot performs five-dimensional tasks, and there are infinite joint configurations for a six-axis industrial robot to realize a cutter location data of the tool path. The robot joint motion can be optimized by taking advantage of the kinematic redundancy, and the collision-free joint motion with minimum joint movement is determined as the optimal. However, most existing redundancy optimization methods do not fully exploit the redundancy of the six-axis industrial robots when they conduct five-dimensional tasks. In this paper, we present an optimization method to solve the problem of inverse kinematics for a six-axis industrial robot to synthesize the joint motion that follows a given tool path, while achieving smoothness and collision-free manipulation. B-spline is applied for the joint configuration interpolation, and the sum of the squares of the first, second, and third derivatives of the B-spline curves are adopted as the smoothness indicators. Besides, the oriented bounding boxes are adopted to simplify the shape of the robot joints, robot links, spindle unit, and fixtures to facilitate collision detections. Dijkstra's shortest path technique and Differential Evolution algorithm are combined to find the optimal joint motion efficiently and avoid getting into a local optimal solution. The proposed algorithm is validated by simulations on two six-axis industrial robots conducting five-axis flank milling tasks respectively.