Epigenetic modulation of Fgf21 in the perinatal mouse liver ameliorates diet-induced obesity in adulthood. Here, FGF21 is linked to obesity due to melanocortin 4 receptor deficiency.