A refrigerator with a lifting shelf, comprising: a storage compartment, wherein a lifting shelf, a shelf driving mechanism for driving the lifting shelf to move up and down and a shelf stroke detection device for detecting a maximum moving stroke of the lifting shelf are disposed in the storage compartment, the shelf driving mechanism comprises: a driving motor and a gear transmission mechanism, wherein the gear transmission mechanism comprises at least one group of transmission gears, the driving motor outputs a torque by a driving output shaft and a first pulley is disposed on the driving output shaft; a guide rail fixed in the storage compartment, wherein the guide rail is slidably connected to a support piece on the guide rail, and the lifting shelf is fixedly connected with the support piece; and a traction cable, where the traction cable is wound around the first pulley, and the other end of the traction cable is fixedly connected with the support piece; the shelf stroke detection device comprises: a stroke switch wherein a trigger portion is disposed on the stroke switch; and a linkage piece wherein the linkage piece cooperates with the stroke switch and the transmission gear respectively, a positioning portion is disposed on an inner wheel surface of the transmission gear, and when the driving motor drives the transmission gear to rotate until the positioning portion is in contact with the linkage piece, the linkage piece triggers the trigger portion of the stroke switch, wherein the driving motor, the gear transmission mechanism and the shelf stroke detection device are mounted in a motor mounting box, characterized in that, the stroke switch is fitted at a side surface of the motor mounting box, the linkage piece is swingably connected to the motor mounting box, a reset spring is disposed between the linkage piece and the motor mounting box, and an elastic force of the reset spring is applicable to abutting the linkage piece against a trigger portion of the stroke switch. the shelf driving mechanism comprises: a driving motor and a gear transmission mechanism, wherein the gear transmission mechanism comprises at least one group of transmission gears, the driving motor outputs a torque by a driving output shaft and a first pulley is disposed on the driving output shaft; a guide rail fixed in the storage compartment, wherein the guide rail is slidably connected to a support piece on the guide rail, and the lifting shelf is fixedly connected with the support piece; and a traction cable, where the traction cable is wound around the first pulley, and the other end of the traction cable is fixedly connected with the support piece; the shelf stroke detection device comprises: a stroke switch wherein a trigger portion is disposed on the stroke switch; and a linkage piece wherein the linkage piece cooperates with the stroke switch and the transmission gear respectively, a positioning portion is disposed on an inner wheel surface of the transmission gear, and when the driving motor drives the transmission gear to rotate until the positioning portion is in contact with the linkage piece, the linkage piece triggers the trigger portion of the stroke switch, wherein the driving motor, the gear transmission mechanism and the shelf stroke detection device are mounted in a motor mounting box, characterized in that, the stroke switch is fitted at a side surface of the motor mounting box, the linkage piece is swingably connected to the motor mounting box, a reset spring is disposed between the linkage piece and the motor mounting box, and an elastic force of the reset spring is applicable to abutting the linkage piece against a trigger portion of the stroke switch.