By analyzing the physiological structure and motion characteristics of human ankle joint, a four degree of freedom generalized spherical parallel mechanism is proposed to meet the needs of ankle rehabilitation. Using the spiral theory to analyze the motion characteristics of the mechanism and based on the method of describing the position with spherical coordinates and the posture with Euler Angle, the inverse solution of the closed vector equation of mechanism position is established. The workspace of mechanism is analyzed according to the constraint conditions of inverse solution. The workspace of the moving spherical center of the mechanism is used to match the movement space of the tibiotalar joint, and the workspace of the dynamic platform is used to match the movement space of subtalar joint. Genetic algorithm is used to optimize the key scale parameters of the mechanism. The results show that the workspace of the generalized spherical parallel mechanism can satisfy the actual movement space of human ankle joint rehabilitation. The results of this paper can provide theoretical basis and experimental reference for the design of ankle joint rehabilitation robot with high matching degree.