We have studied the UV–vis absorption spectra of metal-free phthalocyanine (H2Pc), metal-free pyrazinoporphyrazine (H2PyzPz) and their complexes with Mg2 + and Zn2 + using semiempirical Zerners intermediate neglect of differential overlap and time-dependent density functional theory methods. The predicted absorption spectra of H2Pc and their complexes are in agreement with a previous experiment report. The calculated results show that the Q band absorption peaks of H2PyzPz and their complexes are blue-shifted by 40 nm as compared with those of H2Pc and their complexes, respectively. The frontier molecular orbitals (HOMO and LUMO) of H2Pc, H2PyzPz and their metal complexes were investigated as well. The nitrogen atoms in the pyrazine rings stabilise the HOMO more than the LUMO, and the deprotonation of the pyrrole rings induced by the metal coordination destabilises the LUMO more than the HOMO. Because of the increased band gap, the absorption bands of H2PyzPz and the metal-coordinated compounds are blue-shifted.