During this work, the characterization of urban wastewater from Fez City consisting mainly of a mixture of industrial and urban discharges and its treatment using the coagulation-flocculation (C-F) process was conducted. Three coagulants were used: lime (Ca(OH)2), ferric chloride (FeCl3), and alum (Al2(SO4)3). FeCl3 achieved the highest reduction of turbidity, chemical oxygen demand (COD), and color, thereby the Box-Behnken design was applied to optimize the amount of coagulant and flocculant, and pH. Therefore, the maximum response values were 78%, 98%, and 99% for COD, color, and turbidity, respectively, under the optimal operating conditions: [FeCl3] = 720 mg/L, [flocculant] = 150 mg/L, pH = 7. The operational cost of C-F implemented in this study was estimated at 0.52 US$/m3, proving that it could be a competitive and cost-effective process for the treatment of wastewater. These results will contribute to the existing literature and would be valuable for scaling up the C-F process.