The invention discloses resilient magnetic carbon foam and a preparation method thereof. The magnetic carbon foam material is prepared from melamine foam through ultrasonic cleaning, magnetic metal ion solution soaking and carbonization pyrolysis in an argon atmosphere. The resilient magnetic carbon foam is composed of a melamine foam carbonized porous framework, magnetic metal nanoparticles and carbon nanotubes formed by catalyzing the magnetic metal nanoparticles, and the magnetic metal nanoparticles are coated with the generated carbon nanotubes and evenly distributed on the surface of themelamine foam framework. The magnetic carbon foam has the advantages of magnetism, electrical conductivity, low density, high specific surface area, high resilience and the like; the resilient magnetic carbon foam has good application prospects in the fields of electromagnetic shielding and wave absorption, magnetic sensors, oil absorption, electrochemical catalysis, battery electrodes, supercapacitors and the like, and especially in the aspect of electromagnetic wave absorption, broadband strong absorption of electromagnetic waves can be achieved under the condition of a low addition amount.