We study the phase transition of thin films in the three-dimensional XY universality class. To this end, we perform a Monte Carlo study of the improved two-component φ 4 model, the improved dynamically diluted XY model and the standard XY model on the simple cubic lattice. We study films of a thickness up to L 0 = 32 lattice spacings. In the short direction of the lattice free boundary conditions are employed. Using a finite size scaling (FSS) method, proposed recently, we determine the transition temperature with high accuracy. The effectively two-dimensional finite size scaling behaviour of the Binder cumulant U 4 , the second moment correlation length over the lattice size ξ 2nd /L, the ratio of the partition functions with antiperiodic and periodic boundary conditions Z a /Z p and the helicity modulus Υ clearly confirm the Kosterlitz-Thouless nature of the transition. We analyse the scaling of the transition temperature with the thickness L 0 of the film. The predictions of the renormalization group (RG) theory are confirmed. We compute the universal ratio of the thickness of the film L 0 and the transversal correlation length ξ T in the three-dimensional thermodynamic limit at the Kosterlitz-Thouless transition temperature of a film of thickness L 0 : [L 0,KT /ξ T ] * = 1.595 (7). This results can be compared with experimental results on thin films of 4 He near the λ-transition.