In the present study, the treatment of carpet cleaning wastewater was optimized for electrocoagulation-flotation (ECF) followed sedimentation. In the experimental study, an ECF reactor equipped with four monopolar, parallel-connected aluminum electrodes was utilized. For the optimization, the process variables were selected as methylene blue active substance (MBAS), chemical oxygen demand (COD), and turbidity removal efficiencies, along with the characterization of sludge settling volume at 60 min ( SSV 60). For this goal, response surface methodology (RSM) under central composite design ( CCD) was employed to optimize the critical factors viz. pH (3.64-10.36), current intensity (0.66-2.34 A), and electrolysis time (9.55-110.45 min). RSM-CCD optimized these key factors to achieve maximum removal efficiencies and minimize SSV60. Based on the RSM-CCD prediction, the optimum operating conditions were as pH of 5.1, the current intensity of 2 A, and electrolysis time of 53.5 min, in which the obtained model predicted 83.56%, 82.54%, 88.14%, and 226.22 mL/L for MBAS, COD, turbidity, and SSV 60. Correspondingly, the predictions were in agreement with the actual results (85.50%, 84.35%, 90.50%, and 240.17 mL/L, respectively). The operating cost in the optimal conditions was calculated as 0.673 USD/m(3). The results of the study indicated that the electrocoagulation-flotation followed sedimentation was a cost-effective treatment process in removing target pollutants from the carpet cleaning wastewater.