The invention discloses a biocompatible polymer for covalently modifying magnetic nanoparticles. The biocompatible polymer may be coupled to a targeting agent and/or a fluorescent dye. The invention also discloses a magnetic nanoparticle with biocompatibilities comprising the biocompatible polymer.