The electronic structure of GC and AT stacked dinucleotides, in two different forms of DNA (B and Z) is studied, using density functional theory. B3PW91 basis functional with 6-31G** basis set is applied to investigate molecular orbital distributions and energy levels of stacked dinucleotides in B-DNA and Z-DNA. It is demonstrated that the distribution of molecular orbitals in GC dinucleotide, in B form of DNA, is different from those in Z form. While HOMO in B-DNA is localized on guanine base, in Z-DNA, it is dragged away from the base and spreads over DNA backbone as well. Moreover, the energy levels of orbitals are also different. For AT stacked dinucleotide, it is shown that HOMO in B-DNA is localized on phosphate-sugar backbone whereas in Z-DNA it is localized on thymine base. It is also noted that energy levels of molecular orbitals being localized on DNA backbone, are 0.8 eV less than that of HOMO energy level, indicating the active participation of phosphate-sugar backbone of B- and Z-DNA in chemical reactions.