In this study, the leaf extract of the plant Daphne gnidium L. (Thymemeacea) was used as a corrosion inhibitor for mild steel in 0.1 M NaCl. The content of total polyphenols was evaluated by UV visible spectrophotometry and with cyclic voltammetry. The results show that the extract contains a high content of total phenols estimated at 90.26 (mg GAE/g). Besides this, the plant extract was characterized via Fourier transform infrared spectroscopy. Electrochemical impedance spectroscopy and polarization techniques were used to investigate the extract's anticorrosive performance. The results indicated that the addition of 3% of the extract increased the inhibition efficiency to 90.8% after 4 h of immersion. In addition, the results of the polarization tests showed that the extract acted as a mixed‐type inhibitor, mainly affecting the anodic reaction. Scanning electron microscopy was used to study the morphology of the metal surface. The results revealed a less corrosion impact on mild steel in an inhibited solution.