In the petroleum industry, organic surfactant type inhibitors have been widely applied in the oil and gas industry considering their high efficiency. Carbon steels with various carbide contents have also been used extensively as pipeline materials during the transport and storage of crude oil due to their excellent mechanical properties and low cost. The previous investigation of inhibition mechanism on carbon steel is limited by lack of surface characterization techniques at a molecular level. Atomic force microscopy (AFM) can not only provide localized visual observation, but can also achieve the detection of mechanical properties of an inhibitor film. In this study, in situ AFM contact mode friction imaging and in situ AFM tapping mode phase imaging techniques have been applied to investigate the influence of the ferritic-pearlitic microstructure of carbon steel on inhibitor adsorption mechanisms during CO2 corrosion under different inhibitor concentrations. At concentration above surface saturation, AFM contact mode friction images show a large friction contrast between inhibitor covered cementite structures and ferrite structures, while in the absence of inhibitor, this friction contrast almost disappears, indicating the inhibitor adsorption induced this difference. AFM tapping mode phase images indicate uniform adsorption of inhibitor on both cementite and ferrite structures.The differences observed in these AFM analyses indicate that the adhesion force of inhibitor molecules on cementite could be smaller than on ferrite, or the molecular orientations of inhibitor molecules adsorbed on cementite and ferrite structures could be different. The special adsorption behavior of inhibitor molecules on cementite means the carbide component of the microstructure could directly influence inhibitor adsorption and may decrease inhibitor efficiency. Simultaneous linear polarization resistance tests in electrochemical AFM (EC-AFM) cell indicates a maximum inhibition efficiency at concentration above saturation.Keywords : Contact mode AFM, friction contrast, tapping mode AFM, phase contrast, cementite, ferrite, organic inhibitor, adhesion force.Statement of importance:Studies related to inhibitor adsorption mechanisms on ferritc-pearlitic carbon steels can be connected with the practical issues that iron carbide can impair the corrosion inhibitor performance on carbon steels. This AFM work connects the corrosion inhibition effect with the carbon steel components at a molecular level for the first time. Physical explanations regarding the interactions between inhibitor molecules and carbon steel microstructures can also be provided with the assistance of molecular simulations.Figure caption: Contact and tapping mode AFM images of inhibitor film formed on UNS G1018 steel at 2 CMC (100ppm) tetradecyldimethylbenzylammonium inhibitor + 1 wt% NaCl. The contact mode friction image indicates a large friction contrast between inhibitor covered cementite and ferrite structure, while the tapping mode phase image indicates a negligible softness contrast between cementite and ferrite structure. Figure 1