This study investigates the treatments of hospital wastewater by electrocoagulation using Fe, Al, and stainless steel (SS) electrodes in a batch electrochemical reactor. Parameters that affected the removal of total organic carbon (TOC) of the wastewater with a pH from 5 to 8 and a current density (CD) ranging from 2.03-4.87 mA/cm(2) were examined. The optimum conditions were determined using response surface methodology. In accordance with the suggested mathematical models, maximum TOC removal efficiency was calculated as 99.11% (pH 7.56, CD 4.87 mA/cm(2)), 99.91% (pH 5.45, CD 4.46 mA/cm(2)), and 99.89% (pH 7.80, CD 2.68 mA/cm(2)) for the Fe, Al, and SS electrodes, respectively. The experimental results were also in reasonable agreement with the used model. For all electrodes, the removal efficiencies were high. After analysis of variance (ANOVA), the determination coefficients of the models were R-Al(2) 99.87%, R-Fe(2) 96.02%, and R-SS(2) 94.15% showing that the quadratic models were a good fit and of high significance. The model predictions were confirmed to be appropriate to the experimental data with a deviation of <2.5%. In addition, the SS electrode is better than the Fe and Al electrodes according to energy consumption cost.