The inner shell excitation of pyrimidine and some halogenated pyrimidines near the C and N K-edges has been investigated experimentally by near edge x-ray absorption fine structure spectroscopy and theoretically by density functional theory calculations. The selected targets, 5-Br-pyrimidine, 2-Br-pyrimidine, 2-Cl-pyrimidine, and 5-Br-2-Cl-pyrimidine, allow the effects of the functionalization of the pyrimidine ring to be studied either as a function of different halogen atoms bound to the same molecular site or as a function of the same halogen atom bound to different molecular sites. The results show that the individual characteristics of the different spectra of the substituted pyrimidines can be rationalized in terms of variations in electronic and geometrical structures of the molecule depending on the localization and the electronegativity of the substituent.