The invention discloses a locking device and a refrigerator, wherein the locking device comprises a first lock block and a second lock block; the first lock block comprises a base and a tongue; the second lock block comprises an accommodating cavity, a clamping block, a return spring and a pushing block; the pushing block pushes the clamping block to slide in the sliding groove; and the tongue enters the tongue channel to be engaged with the clamping block so that the two lock blocks are engaged with each other. The locking device has the function of automatically adjusting the height difference between different cabinet doors and cabinet bodies, and is therefore more flexibly suitable for locking various cabinets or refrigerators.