The inhibiting impact of two ecofriendly 5-arylidene barbituric acid derivatives (5-ABA), namely 5-(3,4-dimethoxybenzylidene)-1,3-dimethylpyrimidine-2,4,6(1H,3H,5H)-trione (inhibitor I, 3a) and 5-(3,4-dimethoxybenzylidene)-1,3-diethyl-2-thioxodihydropyrimidine-4,6(1H,5H)-dione (inhibitor II, 3b), in 1 M HCl on the corrosion of carbon steel has been examined via the weight loss (WL) method, potentiodynamic polarization (PP), electrochemical impedance spectroscopy (EIS), and electrochemical frequency modulation (EFM) tests. In addition, DFT calculations and MC simulations were used to study the relationship between the inhibitor structure and its inhibition performance. The attained outcomes exhibit that the investigated compounds are excellent inhibitors and their inhibition efficiency (%IE) increases with the increase in the concentration and temperature. The adsorption of 5-arylidene barbituric acid on the C-steel surface was found to follow the Langmuir adsorption isotherm. The adsorption process of the investigated compounds is spontaneous and considered as the chemisorption type. The PP curves revealed that 5-arylidene barbituric acid derivatives are mixed-type inhibitors. Moreover, the EIS results confirmed the adsorption of 5-arylidene barbituric acid derivatives on the C-steel surface by increasing the charge transfer resistance (Rct) values. The %IE of the inhibitors (II & I) reached 92.8% and 86.6% at a concentration of 21 × 10−6 M, according to the WL method. The surface analysis of the C-steel surface was confirmed by scanning electron microscopy and energy dispersive X-ray techniques. Finally, the experimental and theoretical results are in good agreement.