A rifle gunstock switching mechanism comprises a rifle rear cartridge receiver, a gunstock, a hinged lug base, a blocking bolt, a thrusting spring, a hinged shaft and a swinging rod. The rear part ofthe rifle rear cartridge receiver is provided with a hinged lug base installation hole, the hinged lug base is located in the hinged lug base installation hole and can axially move in the hole, the blocking bolt is fixedly arranged in a hole opening, and the thrusting spring is arranged between the blocking bolt and the hinged lug base. The swinging rod is connected with the hinged lug base through the hinged shaft, the gunstock is internally provided with a swinging rod insertion hole, the swinging rod is inserted into the hole, and the gunstock can do linear movement along the swinging rod.The swinging rod is a hollow rod body, and a position adjusting and positioning structure is arranged between the gunstock and the swinging rod. The position adjusting and positioning structure comprises a special-shaped positioning pin and a guide sliding groove, the guide sliding groove is formed in the swinging rod body, the special-shaped positioning pin is composed of a cylindrical rod, a finger pressing disk and a positioning disk, the two ends of the guide sliding groove are provided with positioning disk limiting holes, the positioning disk is located on the inner side of the swingingrod body, the cylindrical rod penetrates through the guide sliding groove and a gunstock shell, the finger pressing disk is located on the outer side of the gunstock shell, and a reset spring is arranged between the finger pressing disk and the gunstock shell.