In the current study, the electrochemical oxidation of caffeic acid (CA) has been studied in the presence of 2-mercaptobenzoxazole (2) and 2-mercaptobenzimidazole (3). It is demonstrated that electrochemically produced o-benzoquinone is removed by 2 and 3 to give final products via an EC mechanism pathway. The ΔGtot of studied species calculated by the use of a general thermodynamic cycle, were used to mechanism study of the electrochemical oxidation of CA in the presence of both nucleophiles. It was found that ΔGtot of the products is more than that of CA. The computational data were obtained using a DFT (Bp86) level of theory and 6-31G (d, p) basis set. In this work, we introduce new compounds with good yields through a catalyst-free and environmentally friendly method at room temperature under green conditions.