Polyaniline (PANI) is one of the most studied conducting polymers. Obtained in its conducting form (known as "emeraldine salt") by chemical or electrochemical oxidation of aniline in aqueous acidic medium, this polymer manifests an array of attractive properties. In our work, we investigate the properties of PANI in the form of nanofibers and establish the relationship between the level of doping, optical properties and the conductivity. Two methodologies, chemical and electro-chemical polymerization were used to deposit PANI. In former, dedoped PANI was deposited as a thin film on the glass substrate which was then doped with different concentrations of hydrochloric acid (HCl) to observe the change in conductivity and color. UV-Visible spectra (transmittance and absorbance) of the films were acquired and their conductivities were measured using a four-probe setup. In the latter method, PANI in the emeraldine salt form were deposited on ITO glass using an electrolytic cell. The voltage, temperature and electrolytic environment were varied to analyze the effect of change of doping levels on the optical and electrical properties of PANI. Surface electron microscope images were also taken which showed the nanofibers possessing circular cross sections in the order of 30-60 nm.