Origami can turn a sheet of paper into complex three-dimensional shapes, and similar folding techniques can produce structures and mechanisms. To demonstrate the application of these techniques to the fabrication of machines, we developed a crawling robot that folds itself. The robot starts as a flat sheet with embedded electronics, and transforms autonomously into a functional machine. To accomplish this, we have developed shape memory composites that fold themselves along embedded hinges. We use these composites to recreate fundamental folded patterns, derived from computational origami, which can be extrapolated to a wide range of geometries and mechanisms. This origami-inspired robot can fold itself in four minutes and walk away without human intervention, demonstrating the potential both for complex self-folding machines and autonomous, self-controlled assembly.