Abstract Background While excess weight in adulthood and childhood has been associated with increased cancer risk, the link between childhood-to-adulthood body size trajectories and cancer risk requires further investigation. Methods We used data from the UK Biobank, a prospective population-based cohort study. The main exposure was childhood-to-adulthood body size trajectory, constructed from self-reported body at age 10 (categories: thinner, average, and plumper than average) and measured body mass index (BMI) at recruitment (normal weight, overweight, and obese). Primary outcome was obesity-related cancer (13 different cancer types). Results During a median follow-up of 11.7 years, 21,289 participants developed obesity-related cancers. Having a larger body size at age 10 was strongly associated with being overweight or obese in adulthood. Compared to participants with average childhood to normal adulthood body size trajectory, all trajectories ending in overweight or obesity in adulthood were strongly associated with an increased risk of obesity-related cancers. The strength of the association was mostly determined by adulthood BMI, and similar patterns were observed for colorectal, endometrial, kidney, pancreatic and esophageal cancer. However, a larger body size in childhood was associated with a lower risk of postmenopausal breast cancer. Conclusions Although a larger body size in childhood predisposes to overweight and obesity in adulthood, it does not necessarily predispose to an increased obesity-related cancer risk if measures to maintain a healthy weight are taken in adulthood. Key messages • While larger body size in childhood predisposes individuals to overweight and obesity in adulthood, maintaining a healthy weight in adulthood may help mitigate the risk of obesity-related cancers. • Our findings highlight the importance of preventing and reducing overweight and obesity in adulthood for primary cancer prevention.