We compute the electronic structure and optical excitation energies of metal-free and transition metal phthalocyanines (H2Pc and MPc for M = Fe, Co, Ni, Cu, Zn, Mg) using density functional
theory with optimally-tuned range-separated hybrid functionals (OT-RSH).We show that the OT-RSH approach provides photoemission spectra in quantitative agreement with experiments
as well as optical band gaps within 10% of their experimental values, capturing the interplay of localized d-states and delocalized pi-pi* states for these organometallic compounds. We examine the tunability of MPcs and H2Pc through fluorination, resulting in quasi-rigid shifts of the molecular orbital energies by up to about 0.7 eV. Our comprehensive dataset provides a new computational benchmark for phthalocyanines molecules, significantly improving upon other density-functional-theory-based approaches.