The keto-enol tautomerism of 4-hydroxypyrimidine and of the related molecules S-methyl-2-thiouracil and 2-thiouracil has been investigated using synchrotron-based techniques. The populations of the constituent tautomers and thermodynamic parameters have been obtained by analysis of core-level photoemission spectra. The effect of substituents on the stability of tautomers has been revealed. Attaching additional OH (or SH) groups to the aromatic ring stabilizes the dioxo (or oxo-thione) forms. However, substitution of hydrogen in position 2 by an S-CH(3) group (that is, in going from 4-hydroxypyrimidine to S-methyl-2-thiouracil) does not significantly affect the tautomeric equilibrium.