Magnetic cell sorting provides a valuable complementary mechanism to fluorescent techniques, especially if its parameters can be fine-tuned. In addition, there has recently been growing interest in studying naturally occurring magnetic cells and genetic engineering of cells to render them magnetic in order to control molecular processes via magnetic fields. For such approaches, contamination-free magnetic separation is an essential capability. We here present a robust and tunable microfluidic sorting system in which magnetic gradients of up to 1700 T/m can be applied to cells flowing through a sorting channel by reversible magnetization of ferrofluids. Visual control of the sorting process allowed us to optimize sorting efficiencies for a large range of sizes and magnetic moments of cells. Using automated quantification based on imaging of fluorescent markers, we showed that macrophages containing phagocytosed magnetic nanoparticles, with cellular magnetic dipole moments on the order of 10 fAm(2), could be sorted with an efficiency of 90 +/- 1%. Furthermore, we successfully sorted intrinsically magnetic magnetotactic bacteria with magnetic moments of 0.1 fAm(2). In distinction to column-based magnetic sorting devices, microfluidic systems can prevent sample contact with superparamagnetic material. This ensures contamination-free separation of naturally occurring or bioengineered magnetic cells and is essential for downstream characterization of their properties.