This study reports a novel approach for separation of charged species using anion-exchange hydrogel (AEH) and cation-exchange hydrogel (CEH) in a microfluidic device. The capillary line pinning technique, which is applied in this study, enables in situ fabrication of alternating AEH and CEH that are placed in confined compartments. Adjacent enriched and depleted streams are obtained in continuous flow when a potential difference is applied over the hydrogel stack. The desalination performance of the microchip is demonstrated at different salt concentrations (0.01 × 10−3–1× 10−3m sodium chloride), potentials (10–100 V), current densities (12–28 A m−2), and liquid flow rates (0–5 µL min−1). It is shown that the microchip is able to remove ≈75% of the salt initially present in the depleted outlet streams at inlet stream concentrations of 1 × 10−3m sodium chloride. Besides desalination, the microchip allows study of ion transport in the ion-selective hydrogels to elucidate the interplay of transport phenomena at the electrolyte–hydrogel interface during the desalination process.