We present M06-2X density functional calculations of the chloroform/water partition coefficients of cytosine, thymine, uracil, adenine, and guanine and calculations of the free energies of association of selected unsubstituted and alkylated nucleotide base pairs in chloroform and water. Both hydrogen bonding and π-π stacking interactions are considered. Solvation effects are treated using the continuum solvent models SM8, SM8AD, and SMD, including geometry optimization in solution. Comparison of theoretical results with available experimental data indicates that all three of these solvation models predict the chloroform-water partition coefficients for the studied nucleobases qualitatively well, with mean unsigned errors in the range of 0.4-1.3 log units. All three models correctly predict the preference for hydrogen bonding over stacking for nucleobase pairs solvated in chloroform, and SM8, SM8AD, and SMD show similar accuracy in predicting the corresponding free energies of association. The agreement between theory and experiment for the association free energies of the dimers in water is more difficult to assess, as the relevant experimental data are indirect. Theory predicts that the stacking interaction of nucleobases in water is more favorable than hydrogen bonding for only two out of three tested hetero-dimers.