This study compares the effectiveness of pollutant removal from synthetic dairy wastewater electrocoagulated by means of aluminum and iron anodic dissolution. A method based on the cubic function (third degree polynomial) was proposed for electrocoagulant dosing. Mathematical methods for calculating the optimal electrocoagulant doses proved to be quite precise and useful for practical applications. The results of gravimetric measurements of electrocoagulant (electrode) consumption demonstrated that theoretical doses of Al determined based on Faraday's law were substantially lower than those produced by electrode weighing. The above phenomenon was also discussed in the light of the results of polarization resistance measurements for Al and Fe electrodes used in the study.