In this paper, a high-performance impedance humidity sensor based on defect control TiO2/CdS heterostructure was synthesized by hydrothermal method, and the influence of surface vacancy defects on sensing performance was analyzed by first principles based on density functional theory (DFT). Calculation results show that a large number of surface oxygen and sulfur vacancies appear on the surface of TiO2 and CdS, resulting in a great enhancement of the physical/chemical adsorption energy of TiO2 and CdS on water molecules, which is conducive to TiO2/CdS to capture more water molecules and improving the humidity sensitivity performance of the sensor. Experiments show that the regulation of surface vacancy defects of composite materials can effectively improves responsivity, linearity and hysteresis of TiO2/CdS humidity sensor. Compared with TiO2 and CdS, the TiO2/CdS humidity sensor exhibits high sensitivity (63459), fast response/recovery time (7/5 s), low hysteresis (∼3.5 %), good repeatability and long-term stability in a range of 11–95 % RH. This study not only provides an idea for designing defective TiO2/CdS high-performance humidity sensors, but proposes a new understanding for exploring the underlying mechanism of sensor performance.