Conductive polyaniline (PANI) films were deposited on mild steel by an electropolymerization technique in the presence of different types of phosphonium-based ionic liquids, including tetrabutylphosphonium bromide, tetraoctylphosphonium bromide, and ethyltributylphosphonium diethylphosphate. The formation of the PANI films was followed by repetitive cyclic voltammetry scans and was confirmed with diffuse reflectance infrared Fourier transform spectroscopy. The morphology, surface roughness parameters, and grain sizes of these coatings were evaluated by atomic force microscopy. The corrosion behavior of the bare and PANI-coated electrodes was investigated by potentiodynamic polarization, open-circuit potential, and electrochemical impedance spectroscopy techniques in a simulated marine environment in 3.5 wt % aqueous NaCl solutions. The quantum chemical parameters of the PANI composite films were also calculated with parametric method 3, a semi-empirical quantum mechanical method. The theoretical conclusions were found to be consistent with the reported experimental data. (C) 2016 Wiley Periodicals, Inc.