The clinical efficacy of bariatric surgery has encouraged the scientific investigation of the gut as a major endocrine organ. Manipulation of gastrointestinal anatomy through surgery has been shown to profoundly affect the physiological and metabolic processes that control body weight and glycaemia. The most popular bariatric surgical procedures are gastric bypass, adjustable gastric banding and vertical sleeve gastrectomy. Even though these procedures were designed with the aim of causing restriction of food intake and nutrient malabsorption, evidence suggests that their contributions to weight loss are minimal. Instead, these interventions reduce body weight by decreasing hunger, increasing satiation during a meal, changing food preferences and energy expenditure. In this Review, we have explored these mechanisms as well as their mediators. The hope is that that their in-depth investigation will enable the optimization and individualization of surgical techniques, the development of equally effective but safer nonsurgical weight-loss interventions, and even the understanding of the pathophysiology of obesity itself.