In this study, response surface methodology approach using Central Composite Design was applied to develop a mathematical model and to optimize process parameters for the COD, color, orthophosphate, TSS, and turbidity removal from dairy wastewater by electrocoagulation process using iron and aluminum electrodes. The second-order regression model was developed to predict the removal efficiencies using Statgraphics Centurion XVI.I software program. The optimum conditions for the COD removal were found to be 5.06min for reaction time, 5.0 for pH, and 50.5A/m(2) for current density with Al electrodes, whereas 5.21min for reaction time, 5 for pH, and 65A/m(2) for current density with Fe electrodes. High removal efficiencies (98.91% COD and 99.78% orthophosphate removal with Al electrodes, and 98.84% COD and 98.24% orthophosphate removal with Fe electrodes) were achieved under optimum conditions. The operating costs for the COD removal from dairy wastewater by electrocoagulation process using Fe and Al electrodes at optimized conditions were calculated to be 0.54 and 0.42Euro/m(3), respectively. The sludge formed under optimized conditions in EC process was characterized by Fourier Transform Infrared Spectroscopy (FT-IR) analysis. The FT-IR results showed that pollutants in dairy wastewater were linked with aluminum hydroxide and iron hydroxide complexes, precipitated at the bottom of the reactor containing milk components.