Dual metal zeolitic imidazolate frameworks (ZIF-2M) containing Zn and Co were synthesized in aqueous solution. These nanoparticles were characterized by XRD, FESEM, FTIR and BET. The presence of cobalt led to improved chemical and physical properties such as crystal structure, porosity, specific area and magnetic property while keeping the basic structure of ZIFs. Nanoparticles of ZIF-2M and ZIF-8 were applied for removal of cefixime in aqueous solution. Removal efficiency was investigated for both nanoparticles under optimized conditions. Optimum conditions were achieved by BOX-Behnken design. Results revealed the sorption ability of ZIF-2M (97%) is more than that of ZIF-8 (92%). Langmuir and Freundlich isotherms for cefixime sorption by ZIF-2M in optimal conditions were also studied.