The optical properties of sulfonated polyaniline (SPAN) thin film prepared by electrochemical method have been investigated. Polychromic behavior of SPAN thin film (transparent yellow-green-dark blue) was observed when the cyclic voltammograms were taken between -0.25 V and +1.90 V (vs. Ag/AgCl, sat.) during the growth of polyaniline film. In situ UV-vis spectra of the polymers-indium tin oxide (ITO) glass electrode were taken during the oxidation of the polymers at different applied potentials. The direct band gap values of SPAN thin film changed from 3.771 eV to 3.874 eV with the applied potentials. From in situ UV-vis spectra, the optical constants such as refractive index and dielectric constant of the SPAN thin film were determined. The important changes in absorption edge, refractive index and the dielectric constant were observed due to the applied potentials. The refractive index dispersion curves of the film obey the single-oscillator model and oscillator parameters changed with the applied potentials. The most significant result of the present work is in situ spectroelectrochemical method, which can be used to modify the optical band gaps and constants. © 2008 Elsevier B.V. All rights reserved.