The optical properties of several azobenzene derivatives were modulated by varying the dipole moments and conjugation lengths of the D‐π‐A systems. The relationship between the structure and absorption spectrum and polarizability was studied in the gas phase, THF and MeOH solutions, respectively, by using the density functional theory. The calculated absorption spectra and second‐order polarizabilities are in good agreement with the available experimental observations. In comparison with the D‐π‐A monomer, the H‐shaped D‐π‐A dimer almost doubles the dipole moments and hence increases the second‐order polarizabilities, without a significant shift in the maximum absorption bands. The addition of another azobenzol group between electron‐donating and ‐accepting groups increases the second‐order polarizabilities by 4–6 times, but leads to an evident red‐shift of about 65–80 nm in spectra. The relative second‐order polarizability of the halogen‐substituted derivatives is in the sequence of CF3 > F > Cl > Br, without obvious substituent effects on the optical transparency. The D‐π‐A chromophores with the strong electron‐donating (amino) and ‐accepting (acetyl) substituent present the larger second‐order polarizabilities, at the cost of about 20 nm red‐shift of the maximum absorption lengths relative to the halogen‐substituted species. It is also demonstrated that both the linear and nonlinear optical properties augment with the increase in solvent polarity, accompanied by a red‐shift in the wavelengths of maximum absorption by about 18 and 23 nm, respectively, in THF and MeOH solutions. The changes in optical properties upon the structural modifications are further rationalized by the electronic structures of various H‐shaped dimers. Copyright © 2010 John Wiley & Sons, Ltd.