Functionalized octamers of polyaniline neutral forms (leucoemeraldine, emeraldine, pernigraniline) were studied in order to optimize the first hyperpolarizabilities (β). Remarkable static β values were found for the pernigraniline and emeraldine derivatives by using the coupled perturbed Kohn-Sham (CPKS) approach at the PBE1PBE/6-31G** level. The enhanced nonlinear response was achieved through the introduction of donor (D) and/or acceptor (A) groups into the oligoanilines structures. The nonlinear optical (NLO) properties of the octamers missing the substituent groups were also investigated. The largest β values were obtained for the pernigraniline and emeraldine derivatives having the tert-butyl (D) and dicyanoethenyl (A) substituents at opposite ends, as well as the ones with only the acceptor group. These oligomers show charge transfer transitions with large oscillator strengths according to the time dependent density functional theory (TD-DFT). Predicted β values for the majority of functionalized oligoanilines strongly indicate them as potential building blocks for molecular-based nonlinear materials with secondorder response.