Efficient sorbents that have high sorption capacity and suitable separability are promising and are urgently needed to remove diverse contaminants from water environments. In this study, nitrogen-doped magnetic porous biochars (NMPBs) were synthesized from marine algae by a three-step process consisting of prepyrolysis, copyrolysis and coprecipitation. For NMPBs, the surface area was up to 1531 m2/g, the magnetization strength was up to 31 emu/g, and the surface nitrogen content was up to 3 %. The NMPBs showed the expected sorption capability for sulfamethoxazole, with the removal quantity reaching 502 mg g-1 based on the sorption isotherm model. NMPBs also showed excellent separability and reusability, and the removal rate remained at 87 % after seven cycles. Partitioning and adsorption, including pore filling, hydrogen bonding, pi-pi stacking, partitioning and electrostatic interactions, were the sorption processes in removing sulfamethoxazole. In this work, marine algae were converted into an engineered biochar that is promising for environmental remediation.