The effect of a semisynthetic antibiotic cloxacillin is studied for use as a low cost and ecofriendly corrosion inhibitor for mild steel in acidic environment. The corrosion inhibition effect is investigated using weight loss, Tafel polarization, electrochemical impedance spectroscopy and hydrogen permeation studies. The inhibitor showed 81% inhibition efficiency at 15x10-4M concentration of Cloxacillin. Potentiodynamic polarization suggests that it is a mixed type of inhibitor. Electrochemical impedance spectroscopy was used to investigate the mechanism of corrosion inhibition. Hydogen permeation measurements indicated that the compound behave as cathodic inhibitor, but predominantly under mixed control. Diffused reflectance spectroscopy (DRS) studies confirmed only the mere adsorption of cloxacillin on mild steel surface and not influence on the surface morphology. The adsorption of this compound on mild steel surface obeys Temkin's adsorption isotherm.