Magnetic core–shell structured nanoparticles (NPs) have recently attracted great attention as adsorbents because of their excellent adsorption property and easy separation. In this work, Fe3O4@polydopamine core–shell NPs are synthesized by coating a layer of polydopamine (PDA) onto the surface of magnetic Fe3O4 NPs and Fe3O4@carbon NPs are obtained after carbonization of Fe3O4@PDA. Both core–shell NPs are tested as magnetic adsorbents for cationic and anionic dyes. The results show that Fe3O4@PDA NPs have good adsorption property toward methylene blue while Fe3O4@C NPs exhibit excellent performance for methyl orange adsorption. The adsorption behavior performs differently after switch of surface charge for both adsorbents. The adsorption mechanism shows that the adsorption capacity of both Fe3O4@PDA and Fe3O4@C is mainly determined by the electrostatic interaction between adsorbents and dyes.