High level ab initio methods have been used to study stacking interactions in ten unique base pair steps both in A-RNA and in B-DNA duplexes. The protocol for selection of geometries based on molecular dynamics (MD) simulations is proposed, and its suitability is demonstrated by comparison with stacking in steps at fiber diffraction geometries. It is shown that fiber diffraction geometries are not sufficiently accurate for interaction energy calculations. In addition, the protocol for selection of geometries based on MD simulations allows for the evaluation of the variability of the intrinsic stacking energies along the MD trajectories. The uncertainty in stacking energies (difference between the most and least stable geometry) due to the dynamical nature of systems can be, in some cases, as large as 3.0 kcal · mol, which is almost 50% of the actual sequence dependence of base stacking energies (the energy difference between the most and least stable sequences). Thus, assessing the relative magnitude of the gas phase stacking energy using a single geometry for each sequence is insufficient to obtain an unambiguous order of gas phase stacking energies in canonical double helices. Though the ordering of ten unique dinucleotide steps cannot be definitive, some general conclusions were drawn. The stacking energies of base pair steps in A-RNA are more evenly separated compared to B-DNA, and their ordering is less sensitive to the dynamics of the system compared to be B-DNA. The most stable step both in B-DNA and A-RNA is the CG/CG step that is well separated from the second most stable step GC/GC. Also the least stable step (the CC/GG step) is well separated from the rest of the structures. The calculations further show that B-DNA stacking is favorable only marginally (on average by 1.14 kcal · mol -1 per base pair step) over A-RNA stacking, and this difference vanishes after subtracting the stabilizing van der Waals effect of the thymine 5-methyl group that is absent in RNA. Basically, no correlation between the sequence dependence of gas phase stacking energies and the sequence dependence of ∆G°3 7 free energies used in nearest-neighbor models was found either for B-DNA or for A-RNA. This reflects the complexity of the balance of forces that are responsible for the sequence dependence of thermodynamics stability of nucleic acids, which masks the effect of the intrinsic interactions between the stacked base pairs.