AbstractShape memory is the capability of a material to be deformed and fixed into a temporary shape. Recovery of the original shape can then be triggered only by an external stimulus. Shape-memory polymers are highly deformable materials that can be programmed to recover a memorized shape in response to a variety of environmental and spatially localized stimuli as a one-way effect. The shape-memory function can also be generated as a reversible effect enabling actuation behaviour through macroscale deformation and processing, specifically by dictating the macromolecular orientation of actuation units and of the skeleton structure of geometry-determining units in the polymers. Shape-memory polymers can be programmed and reprogrammed into arbitrary shapes. Both recovery and actuation behaviour are reprogrammable. In this Review, we outline the common basis and key differences between the two shape-memory behaviours of polymers in terms of mechanism, fabrication schemes and characterization methods. We discuss which combination of macromolecular architecture and macroscale processing is necessary for coordinated, decentralized and responsive physical behaviour. The extraction of relevant thermomechanical information is described, and design criteria are shown for microscale and macroscale morphologies to gain high levels of recovered or actuation strains as well as on-demand 2D-to-3D shape transformations. Finally, real-world applications and key future challenges are highlighted.