The geometries, electronic structures, polarizabilities, and hyperpolarizabilities of organic dye sensitizers 3,4-pyridinedicarbonitrile, 3-aminophthalonitrile, 4-aminophthalonitrile and 4-methylphthalonitrile were studied based on density functional theory using the hybrid functional B3LYP. Ultraviolet-visible spectra were investigated by time dependent density functional theory. The features of electronic absorption spectra in the visible and near-UV regions were assigned based on time dependent density functional theory calculations. The absorption bands are assigned to pi -> pi* transitions. Calculated results suggest that the three lowest energy excited states of 3,4-pyridinedicarbonitrile, 3-aminophthalonitrile, 4-aminophthalonitrile and 4-methylphthalonitrile are due to photoinduced electron transfer processes. The interfacial electron transfer between semiconductor TiO2 electrode and dye sensitizers 3,4-pyridinedicarbonitrile, 3-aminophthalonitrile, 4-aminophthalonitrile and 4-methylphthalonitrile is due to an electron injection process from excited dyes to the semiconductor's conduction band. The role of amide and methyl groups in phthalonitrile in geometries, electronic structures, and spectral properties were analyzed in a comparative study of 3,4-pyridinedicarbonitrile, 3-aminophthalonitrile, 4-aminophthalonitrile and 4-methylphthalonitrile for the improvement of dye sensitized solar cells.