Mangoes are one of the most abundant fruit tree crops in most countries. Unfortunately, mango leaves are generally dumped as agricultural waste due to their abundance, resulting in significant waste and environmental pollution. In this study, electrochemical and weight loss techniques were utilized to investigate the inhibitory mechanism of mango leaves extract (MLE) on the corrosion of X70 steel in 1 M HCl. The results indicated that MLE was an excellent corrosion inhibitor for X70 steel to resist corrosion in an acidic environment, and the inhibition efficiency was effectively improved by increasing the inhibitor concentration and decreasing the temperature. Electrochemical tests have shown that MLE functions as a corrosion inhibitor with a mixed-type mechanism. Fitting the adsorption isotherm with electrochemical data, confirmed that MLE demonstrates corrosion resistance on metal surfaces through adsorption, and this adsorption conforms to the Langmuir isotherm. The adsorption phenomenon was deeply investigated by using atomic force microscopy (AFM) and scanning electron microscopy (SEM). MLE is further proven to interact with the steel surface to generate an adsorption layer that prevents steel corrosion in an acidic environment. In particular, the density-functional tight-binding (DFTB) calculations results also suggest that the π electron and lone-pair electrons in the main components of MLE are conducive to enhancing the adsorption of corrosion inhibitor molecules on the iron surface, to achieve a more effective inhibition effect. Furthermore, the toxicity prediction indicates that the MLE components are nearly non-toxic, which complies with environmental protection regulations. MLE has excellent corrosion resistance, with a corrosion inhibition efficiency of nearly 90 % at a concentration of 400 mg/L, while also helping to solve agricultural waste management challenges.