Characterization of metal ion binding to RNA and DNA base pairs is important for understanding their energy contribution to the folding and conformational changes of nucleic acid structures. In this study, we examine the equilibrium shift from the hairpin toward the dimer formation, induced by nonspecifically bound metal ions. The hairpin dimerization is markedly enhanced in the presence of high background concentrations of poly(ethylene glycol) (PEG) and several small organic molecules. The simple volume exclusion effect and the base pair stability cannot entirely account for this increase. We find that the dielectric constant correlates well with the dimerization efficiency in the conditions caused by small alcohol molecules and amide compounds as well as PEG. The hairpin dimerization experiments reveal the potential of PEG for enhancing the binding affinity between nucleic acids and metal ions, by reducing the solution dielectric constant without decreasing the thermodynamic stability of nucleic acid structures. The results presented here contribute to the understanding of nucleic acid folding and its ability to switch between alternative conformations under the condition of limited cation availability and cellular physiology.