We have measured the complex film impedance 1/σd (σ conductivity, d film thickness) of three YBaCuO thin films with d = 44, 115, and 168 nm on MgO substrates at 10.2 GHz in the temperature range between 300 and 4 K. Below Tc, the experimental results are discussed in terms of the two-fluid model and the BCS theory. The residual resistance decreases with the film thickness. The thinnest film has a residual surface resistance of 3 · 10−4 Ω. For this film, the complex microwave conductivity is calculated and compared with the models. Apart from the residual resistance, the measured conductivity is in agreement with the peak caused by the energy gap of the BCS theory. All measurements were performed with a cavity perturbation method which we have to our knowledge applied for the first time to superconducting thin films. The method allows to determine the complex impedance of films with arbitrary thickness. In particular, films with thicknesses small compared to the skin depth δ or the London penetration depth λ can be measured. Therefore, we are able to measure the impedance both in the normal and superconducting state.