This article proposes a novel humidity sensor using a microwave resonant cavity as the sensing device. This sensor comprises a high-quality factor resonant cavity and frequency detection circuits. The working frequency of the resonator is 9.6 GHz, it has the characteristics that the resonance frequency can be adjusted, and it is designed with embedded air guide holes to allow moist air to enter the interior of the resonant cavity. According to the perturbation theory, when humid air is distributed in the resonator’s sensing area, the resonator’s resonant frequency changes according to different relative humidity (RH) levels. Then, the frequency detection circuit is used to detect the resonance frequency change, and the RH level related to the shift in the resonance frequency can be obtained. In order to get more accurate measurement results, a temperature and atmospheric pressure compensation algorithm is introduced to correct the measurement results. Experiments show that the proposed humidity sensor effectively detects humidity in an RH environment of 20%-95%. It has the characteristics of fast detection speed and high stability, which avoids the need to use the conventional detection method of the vector network analyzer.