a, Schematic of microbiota transfer to germ-free mice after dieting. Recipients were fed either a HFD or NC. b–d, PCoA of recipient microbiota (b) and relative UniFrac distances to NC controls (c, d) of germ-free mice one week after transplantation with microbiota from weight-cycling mice or controls, and fed either NC (c) or a HFD (d). e, f, Quantifications of weight gain (e) and blood glucose after glucose tolerance test (f) in germ-free recipients of microbiota from weight cycling mice or controls. g, h, Correlation of predicted and measured weight gain when prediction is based solely on inferred history of obesity (g) or solely on 16S sequencing (h). i–k, PCoA of faecal microbiota (i) and relative UniFrac distances between donors (j) and recipients (k) two weeks after the onset of daily FMT from cycHFD or NC mice to mice undergoing weight cycling. l–o, Quantification of secondary weight gain (l), net weight gain induced by 8 weeks of HFD feeding (m), glucose levels after glucose tolerance test (n) and lean mass (o) in weight-cycling mice and controls with or without FMT. Experiments were repeated twice. Data are mean ± s.e.m. n.s., not significant. *P < 0.05, **P < 0.01, ****P < 0.0001 by ANOVA (e, f, l, m, o) or Mann–Whitney U-test (c, d, j, k). See Supplementary Tables 5 and 6 for exact n and P values.