Traditional methods for solving the inverse kinematics of a hyper-redundant manipulator (HRM) can only plan the path of the end-effector with a complicated solving process, where obstacle avoidance is also not considered. To solve the above problems, a novel method for solving inverse kinematics of HRM is proposed in this paper: the variable dimension scaling method (VDSM), which can solve complex inverse kinematics while avoiding obstacles. Through this method, the path of the end-effector is scaled under a certain proportion and is adjusted depending on the position of the obstacle, which has good universality. The number of link angles changed is as small as possible in the process of achieving the end-effector moving along the desired path. With the redundancy of HRM, obstacle avoidance can be implemented in any environment by the proposed method. Through simulation and experiments in different environments, the above advantages of VDSM are verified.