Donor-acceptor substituted diazabutadienes and -hexatrienes were prepared by straightforward procedures and their linear optical (UV-vis) and nonlinear optical second harmonic generation (SGH) properties investigated in a combined theoretical and experimental study. Theoretical and experimental results were in reasonable agreement. For the compounds in this study, which contained a p-nitrophenyl group as electron acceptor, the p-dimethylaminophenyl group was the most powerful electron-donating group, leading to the highest maximum absorption wavelengths, as well as to the maximum SHG efficiency.