Investigation of Euphorbia hirta leaves as green corrosion inhibitor for mild steel in 0.5 M hydrochloric acid using gravimetric and potentiodynamic polarization techniques was carried out. Characterization carried out on the leaves were quantitative, qualitative analyses, Fourier Transform Infrared Spectroscopy (FT-IR), and Gas Chromatography-Mass Spectrometry (GC-MS). Scanning electron microscopy (SEM) attached with electron dispersive spectroscopy (EDS) was used to characterize the Substrates before and after corrosion tests. Both the inhibitor concentration, time, and temperature were varied accordingly. The corrosion rate increased with an increase in temperature and decreased with increases in both inhibitor concentrations and time. An inhibition efficiency of 98.32% recorded at the optimum concentration of 12 g/l. Phytochemical results revealed tannins, alkaloids, saponins, and flavonoids with their contents. FT-IR and GC–MS revealed some functional groups such as Aliphatic cyanide/nitrile, C=N, Primary amine, CN stretch, Aliphatic bromo compounds, C-Br stretch, 7,17 Hexadecadienal, etc which were responsible for the protection of mild steel in the acidic medium. The inhibition efficiency obtained suggested the effectiveness of the inhibitor and acted as a mixed-type inhibitor. The substrates without green inhibitors were rough with severe pits, while the surfaces with optimum green inhibitors were protected. The results obtained from weight loss, and polarization were in good agreement with each other. Green corrosion inhibitors can, therefore, serve as an alternative to synthetic. The inhibition efficiency obtained is well above the minimum acceptable limit of 70% required of a good inhibitor. It can be used in the formulation of paints for coating of pipes.