Despite their potential in various fields such as soft robots, drug delivery and biomedical engineering, magnetic hydrogels have always been limited by their poor mechanical properties. Here a universal soaking strategy has been presented to synthesize tough magnetic nanocomposite (NC) hydrogels. We can simultaneously solve two common issues for magnetic hydrogels: the poor mechanical properties and poor distribution of magnetic particles. The toughness of the magnetic NC hydrogel achieves approximately 11 000 J m-2. The outstanding properties of tough magnetic hydrogels will enable myriad applications. Here we demonstrate a new application for remotely triggered shape morphing. Heterogeneous structures based on magnetic hydrogels are shown to evolve into bio-inspired three-dimensional (3D) shapes (lotus flowers) from 2D-structured sheets. The self-folding of the structure is controlled by the magnetothermal effect in an alternating magnetic field. The capability to control the shape morphing of a multi-material system by a magnetic field may emerge as a new general strategy for programming complex soft structures.