Only 60-75% of conventional kidney stone surgeries achieve complete stone-free status. Up to 30% of patients with residual fragments <2 mm in size experience subsequent stone-related complications. Here we demonstrate a stone retrieval technology in which fragments are rendered magnetizable with a magnetic hydrogel so that they can be easily retrieved with a simple magnetic tool. The magnetic hydrogel facilitates robust in vitro capture of stone fragments of clinically relevant sizes and compositions. The hydrogel components exhibit no cytotoxicity in cell culture and only superficial effects on ex vivo human urothelium and in vivo mouse bladders. Furthermore, the hydrogel demonstrates antimicrobial activity against common uropathogens on par with that of common antibiotics. By enabling the efficient retrieval of kidney stone fragments, our method can lead to improved stone-free rates and patient outcomes.