The invention discloses a desktop type device and method for in-situ measurement of the thickness of a sample under static high pressure, and relates to the technical field of in-situ measurement of the thickness of the sample in a high-pressure sound velocity experiment. The device comprises a control computer, a micro-focus X-ray machine, a large-cavity high-pressure device, an X-ray image detector, an X-ray machine displacement system, a detector displacement system and a shock insulation optical platform, the micro-focus X-ray machine is mounted on the X-ray machine displacement system, and the X-ray image detector is mounted on the detector displacement system; a to-be-tested sample is placed in an anvil of the large-cavity high-pressure device; the X-ray machine displacement system, the large-cavity high-pressure device and the detector displacement system are horizontally mounted on the shock insulation optical platform in sequence; and each subsystem is connected with a control computer through a cable for remote control and data transmission. Compared with a traditional scheme based on a synchrotron radiation light source, the experiment cost and space are greatly reduced, operation and use are easy, and popularization to common small laboratories is facilitated.