Purpose The purpose of this paper is to present a robotic off-line programming method for freeform surface grinding based on visualization toolkit (VTK). Nowadays, manual grinding and traditional robot on-line programming are difficult to ensure the surface grinding accuracy, thus off-line programming is gradually used in grinding, however, several problems are needed to be resolved which include: off-programming environment depends on the third-party CAD software, leads to insufficient self-development flexibility; single support for robot type or workpiece model format contributes to lack of versatility; grinding point data depends on external data calculation and import process, causes human-computer interaction deterioration. Design/methodology/approach In this method, the visualization pipeline and observer/command mode of VTK are used to display the 3D model of the robot grinding system and pick up the workpiece surfaces to be grinded respectively. Two groups of cutter planes with equidistant spacing are created to form the grinding nodes on the surface, and the extraction method for the position and posture of the nodes is proposed. Furthermore, the position and posture of discretized points along the grinding curve are obtained by B-spline curve interpolation and quaternion spherical linear interpolation respectively. Finally, the motion simulation is realized by robot inverse kinematics. Findings Through a watch case grinding experiment, the results show that the proposed method based on VTK can achieving high precision grinding effect, which is obviously better than traditional method. Originality/value The proposed method is universal which does not depend on the specific forms of surface, and all calculations in simulation are completed within the system, avoiding tedious external data calculation and import process. The grinding trajectory can be generated only by the mouse picking operation without relying on the other third-party CAD software.