The electronic ground structure and the anisotropy of the electrical conductivity in W-type hexagonal ferrite BaFe18O27 and BaCo2Fe16O27 have been investigated using the generalized gradient approximation (GGA) plus Hubbard U (GGA+U) calculation. In BaFe18O27, because of the presence of mixed valence states at Fe 6g sites, a half metallic peak appears in energy gap and it results in an “electrical conductive layer”. Using a model in which Fe at 6g sites is assumed to be partially replaced by Co, the electronic ground structure of BaCo2Fe16O27 and the origin of the electrical conductive anisotropy have been studied. Replacement of Fe at 6g site of BaFe18O27 by Co causes the mixed valence states of Fe cations at 6g sites to vanish and the carrier density to lower. Also, it is shown that effective mass of carrier along c axis is much heavier than that perpendicular to c axis in both of materials from electronic energy band calculation. This is the reason why the electrical resistivities of both materials along c axis are much higher than that perpendicular to axis.