Conductive polyaniline (PANI) in various nanostructures were prepared by situ polymerization for corrosion protection application of carbon steel. Anticorrosion performance of the samples was evaluated by applying salt spray and adhesion tests based on standards ASTM B117 and ASTM D3359 respectively. Synthesis of PANI in various nanostructures carried out by doping aniline monomer with phosphoric acid in four different molar ratios. Field emission scanning electron microscopy (FESEM) images confirms the variation in nanostructures of samples. The samples were also characterized using Fourier transform infrared (FTIR), X-ray diffraction (XRD), electrical conductivity and dispersion stability in ethanol medium. The transition of PANI nanostructure from nanofibers to nanorods and nanospheres occurred with the increase of molar ratios (phosphoric acid/aniline) from 0.1, 0.5, 1 and 2 respectively. The results show that coating containing PANI nanofibers has the best resistance against corrosive aggression due to the high dispersion stability and decent uniformity. Accordingly, this work finds that the morphological structure and dispersion stability for PANI has a significant impact on the anticorrosion performance.