We performed a density functional investigation of the interactions of the two alkaline metal ions Rb(I) and Cs(I) and two alkaline earth metal ions Ba(II) and Sr(II), with DNA and RNA nucleobases. All the possible molecular complexes, originated from the attack of these cations to the different binding sites present on some selected low‐lying nucleobase tautomers, were considered to determine their relative stabilities and the preferred metal coordination geometries and sites. Absolute metal ions affinities were computed taking into account the most stable metal complex of each base with the aim to rationalize the trend of the obtained values within of and between the first and second periodic table main groups. © 2009 Wiley Periodicals, Inc. Int J Quantum Chem, 2010