The invention discloses a rotary position sensor, which belongs to the technical field of position sensing, and is characterized by comprising a front shell, a rear shell and a controller, the front shell comprises a base block, a cylinder part, a supporting block and two arc-shaped plates; the end face of the side, close to the rear shell, of the supporting block is fixedly connected with a convex fixed ruler. The bottom surface of the convex fixed ruler is connected with a concave sliding ruler in a sliding manner; a rotating body and a linkage body are embedded in the inner wall of the cylinder part; one end of the linkage body is joggled with the rotating body, the other end of the linkage body is fixedly connected with a screw rod, the outer wall of the screw rod is sleeved with a nut, and the outer wall of the screw rod is meshed with the inner wall of the nut; a round groove is formed in the end face of the side, away from the linkage body, of the nut, an L-shaped rod is movably connected into the round groove, and the top end of the L-shaped rod is fixedly connected with the concave sliding ruler. The device is mainly used for multi-gear rotary input or a multi-gear rotary switch, can freely and continuously rotate, is simple in structure, reliable in operation and accurate in measurement, and can effectively eliminate temperature influence so as to realize long-term use.