In this study, computational fluid dynamics (CFD) was used to analyze the effect of tool shapes in friction stir welding (FSW). In FSW, a tool moves and rotates simultaneously so the interface between the tool and workpiece is changed at every time step. Frictional heat occurs at this interface, and in order to apply this heat, the interface should be tracked. A new interface tracking algorithm, which is applicable to any tool shape, was introduced to track the interface. Furthermore, an average area concept was used to calculate the interface area in each interface cell. This algorithm was applied to three tool shapes: cylinder, screw, and tap shapes. To validate the model, friction stir spot welding (FSSW) was performed for the cylinder type, and FSW was performed for the tap type. Temperature and torque history were compared with the experimental results. With the suggested algorithm, the velocity and viscosity distributions near the tool and the flow pattern obtained using a particle tracking method were used to analyze the characteristics of the tool shapes.