A novel, highly selective and efficient sorbent, was prepared and applied for separation and preconcentration of lead and cadmium from real samples. Lead and cadmium could be quantitatively retained by ionic liquid-modified magnetite nanoparticles and then easily separated from the aqueous solution by applying an external magnetic field; so, no filtration or centrifugation was necessary.