The objective of the present investigation was to construct an electrocoagulation cell in a batch system and to evaluate its capacity to remove the anionic surfactant of the linear alkylbenzene sulfonate (LAS), which is present in gray water determining the effect of the type of electrodes (Al or Fe), distance between electrodes (1, 1.5 and 2 cm) and voltages (10, 15 and 20 V). The experimental tests were carried out for 20 min. The dimensions of the short wave electrolysis cell built in glass were 26 cm long, 7 cm wide and 12 cm high, with 10 electrodes of 12x6 cm supported by a PVC structure. The concentration of LAS in the solution was determined by employing UV-Vis spectrometry applying the Methylene Blue Active Substances (MBAS) method. A higher removal of 65.55% was obtained when aluminum electrodes were used, and 69.11% with iron electrodes a separation of 1.5 cm and a voltage of 20 V, presenting less change in pH, conductivity, and energy consumption when using the Al3 electrode. When evaluating the effect of time at the best experimental configuration (Al, 1.5 cm, 20 V) it was established that the removal efficiency increased to 75.13% in 60 min. Electrocoagulation with aluminum electrodes is presented as an efficient alternative for the removal of LAS in solution.