daf-16/FoxO is required to survive starvation in Caenorhabditis elegans, but how daf-16IFoxO promotes starvation resistance is unclear. We show that daf-16/FoxO restructures carbohydrate metabolism by driving carbon flux through the glyoxylate shunt and gluconeogenesis and into synthesis of trehalose, a disaccharide of glucose. Trehalose is a well-known stress protectant, capable of preserving membrane organization and protein structure during abiotic stress. Metabolomic, genetic, and pharmacological analyses confirm increased trehalose synthesis and further show that trehalose not only supports survival as a stress protectant but also serves as a glycolytic input. Furthermore, we provide evidence that metabolic cycling between trehalose and glucose is necessary for this dual function of trehalose. This work demonstrates that daf-16/FoxO promotes starvation resistance by shifting carbon metabolism to drive trehalose synthesis, which in turn supports survival by providing an energy source and acting as a stress protectant., eLife digest Most animals rarely have access to a constant supply of food, and so have evolved ways to cope with times of plenty and times of shortage. Insulin is a hormone that travels throughout the body to signal when an animal is well fed. Insulin signaling inhibits the activity of a protein called FoxO, which otherwise switches on and off hundreds of genes to control the starvation response. The roundworm, Caenorhabditis elegans, has been well studied in the laboratory, and often has to cope with starvation in the wild. These worms can pause their development if no food is available, or divert to a different developmental path if they anticipate that food will be short in future. As with more complex animals, the worm responds to starvation by reducing insulin-like signaling, which in turn activates a FoxO protein called daf-16. When the worms stop feeding, daf-16 is switched on, which is crucial for survival. It was known how daf-16 stops the roundworm’s development, but it was not known how it helps the worms to survive starvation. Now, Hibshman et al. have compared normal roundworm larvae to larvae that are missing the gene for daf-16 to determine how this protein influences the roundworm’s ability to survive starvation. The worms were examined with and without food, to look for which genes were switched on and off by daf-16 during starvation. This revealed that daf-16 controls metabolism, activating a metabolic shortcut that makes the worms produce glucose and begin turning it into another type of sugar, called trehalose. This sugar usually promotes survival in conditions where water is limiting, like dehydration and high salt, but it can also be broken down to release energy. The levels of trehalose in the worms rose within hours of the onset of starvation. To confirm the importance of trehalose in surviving starvation, roundworms with mutations in genes involved in glucose or trehalose production were examined, as was the effect of giving starving worms glucose or trehalose. Disrupting the production of sugars caused the worms to die sooner of starvation, while supplementing with sugar had the opposite effect meaning the worms survived for longer. Taken together, these findings reveal that daf-16 protects against starvation by shifting metabolism towards the production of trehalose. This helps worms to survive by both protecting them from stress and providing them with a source of energy. These findings not only extend the current understanding of how animals respond to starvation, but could also lead to improved understanding of diseases where this response goes wrong, including diabetes and obesity.