The chemical bonds in clusters may be different to those in the conventional bulk. Bulk magnesium oxide (MgO) is a well-known ionic material with the rocksalt structure. However, the bonding characters of MgO clusters are not clear. (MgO)3n are the magic-size clusters. The rocksalt structure and the hexagonal tube are two basic structural patterns. For large MgO clusters, the rocksalt structures are the most stable, but for small clusters, the hexagonal tubes are preferable in energy. It was suggested that the orbitals of oxygen in the hexagonal tubes hybrid in sp2 and the Mg–O bonds possess considerable covalent characters, and the orbital interaction favours the hexagonal tubes. We investigate the geometric and electronic structures of (MgO)3n (n = 2–8) clusters by ab initio methods. For n = 2–5, the n-stacked hexagonal rings and the 2 × 3 × n rocksalt isomers have the same topological structure and the hexagonal tube is lower in energy. For n = 6 and 8, the rocksalt structures change to 3 × 3 × 4 and 3 × 4 × 4 layers respectively, and they become the most stable configurations. The AIM (atoms in molecules) and NBO (natural bond orbital) analyses show the charge transfer from Mg to O is around 1.78e and 1.52e respectively, which means strongly ionic bonds in MgO clusters. The large charge transfer pushes up the 2p levels drastically in oxygen anions and the wide energy gap hinders the hybridization between the 2s and 2p orbitals of oxygen. In both the rocksalt structures and the hexagonal tubes, the overlap compositions between Mg 3s and O 2p are almost the same, and they do not vary obviously with the cluster size. For small MgO clusters, while there are more Mg–O bonds in the rocksalt structures, the average bond lengths are shorter in the hexagonal tubes, which can compensate for the smaller number of the bonds. For (MgO)18, 24, many more Mg–O bonds form in the rocksalt structures, and this makes the rocksalt structures preferable to the hexagonal tubes.