The structures of the DNA and RNA bases cytosine, uracil, and thymine in thin films with a nominal film thickness of about 20 nm are studied by using X-ray photoemission spectroscopy (XPS) and Fourier-transform infrared spectroscopy. The molecules are evaporated in situ from powder on a gold foil. The experimental results indicate that cytosine is composed of two energetically close tautomeric forms, whereas uracil and thymine exist in only one tautomeric form. Additionally, quantum chemical calculations are performed to complement the experimental results. The relative energies of the tautomeric forms of cytosine, uracil, and thymine are calculated using Hartree-Fock (HF), density functional theory (DFT), and post-HF methods. Furthermore, the assignment of the XPS spectra is supported by using simple model considerations employing Koopmans ionization energies and Mulliken net atomic charges.