In situ scanning tunneling microscopy (STM) was used to study the adsorption and polymerization of aniline on Au(111) single-crystal electrode in 0.1 M perchloric acid and 0.1 M benzenesulfonic acids (BSA) containing 30 mM aniline, respectively. At the onset potential of aniline's oxidation, ∼0.8 V [vs reversible hydrogen electrode], aniline molecules were adsorbed in highly ordered arrays, designated as (3×2√3) and (4×2√3) in perchloric acid and BSA, respectively. These structures consisted of intermingled aniline molecules and perchlorate or BSA? anions zigzagging in the 〈110〉 directions in HClO4 and in the 〈121〉 directions in BSA. The coverage of aniline admolecule on Au(111) was lower in BSA than in HClO4. Raising the potential to 0.9 V or more positive values triggered the oxidation and polymerization of aniline. With aniline molecules arranging in a way similar to the backbone of PAN in HClO4, they readily coupled with each other to produce linear polymeric chains aligned predominantly in the 〈110〉 directions of the Au(111). Compared with the results observed in H2SO4 (Lee et al. J. Am. Chem. Soc. 2009, 131, 6468), the rate of polymerization was slower in HClO4 and the produced PAN molecules tended to aggregate on the Au(111) electrode. PAN molecules generated in HClO4 were anomalously shorter than those formed in H2SO4. In 0.1 M BSA, PAN molecules produced by small overpotential (η < 100 mV) could assume linear chains or 3D aggregates, depending on [aniline]. These results revealed molecular level details in electropolymerization of aniline, highlighting the important role of anion in controlling the conformation of PAN molecules and the texture of PAN film.