PurposeOver the past decade, plant extracts are ultimate green candidatures to substitute the expensive and noxious synthetic corrosion inhibitors. In this regard, this study aims to focus on evaluating anti-corrosion properties of green inhibitor Cyperus rotundus (C. rotundus), a perennial herb found throughout India.Design/methodology/approachThe biocompatible components present in C. rotundus extract was analyzed by gas chromatography–mass spectroscopy analysis. The corrosion inhibitory effect of C. rotundus was assessed by impedance, polarization and surface morphometric study [atomic force microscopy (AFM)]. Density functional theory (DFT) study was carried using DFT/B3LYP, and basis set used for calculations was 6-31G (d, p) using Gaussian 03 program package.FindingsPredominant components such as octadecanoicacid, ethylester, n-hexadecanoic acid, pentanoicacid-4-oxoethyl ester, cyclotrisiloxane, hexamethyl, cyclotetrasiloxane and octamethyl were identified from the extract of C. rotundus. Impedance study demonstrated that the addition of inhibitor reduces the double-layer capacitance and increases the charge transfer resistance. Furthermore, polarization studies indicated that the extract of C. rotundus acted as a mixed-type inhibitor with decrease in corrosion current density with increase in concentration. AFM study evinced the formation of inhibitor film on mild steel surface. The donor–acceptor interactions of active sites of predominant phytoconstituents were substantiated by computational analysis (DFT).Originality/valueThis paper deals with the inhibition effect of extract of C. rotundus on mild steel in 0.5M H2SO4. C. rotundus has a capability to adsorb on the metal surface, thus hindering corrosion.