Climate change and water overextraction are some of the reasons for a growing global water stress, with seawater desalination being the leading solution worldwide. The state-of-the-art technology for seawater desalination is reverse osmosis (RO), utilizing mechanical pressure to push seawater through membranes, leaving the dissolved species in the brine. However, boron, which is considered toxic in high concentrations, is poorly removed by RO. This is because under normal conditions boron is present as boric acid, a small neutrally-charged compound. The most common technique to overcome this problem includes multiple RO stages combined with chemical dosage of the effluent, ensuring boron is present as borate, a charged species, present in high pH conditions.Capacitive deionization (CDI) is an emerging membraneless technique for water treatment and desalination, based on electrosorption of salt ions into microporous electrodes. Large internally-generated pH gradients develop during CDI operation, and thus CDI can potentially remove boron without chemically adjusting the feed pH. Here, we present a novel theoretical framework predicting the adsorption of boron in micropores, while considering pH-dependent chemical surface groups in the micropores, ion transport in the macropores, and local electrolyte pH. Moreover, we account for association and dissociation reactions of boron-consisting compounds in the electrolyte[1].We analyzed the effects electrodes order have on pH dynamics, where panels a. and b. in the attached figure present spatiotemporal plots of the pH for the case where cathode is placed upstream (panel a., cat-an) and the anode placed upstream (panel b., an-cat). This analysis shows that higher pH in the anode are expected for the an-cat configuration, counter to common-wisdom in the field. Panel c. follows this trend, by presenting the removed boron as a function of scaled flow velocity for both configurations. The results show, both experimentally and theoretically, that an-cat configuration should be preferred. Similarly, we found that an optimum charging voltage exists, even without accounting for parasitic reactions. Moreover, we found that also the discharging voltage significantly affects boron removal. Overall, CDI is a promising technology for boron removal, but a deep theoretical understanding of the problem is crucial towards future optimization.