Early life exposure to famine was associated with adulthood metabolic syndrome and nonalcoholic fatty liver disease (NAFLD), and NAFLD was also affected by cardiometabolic traits. However, the role of cardiometabolic traits in the associations from famine exposure to NAFLD was largely unknown. This study aimed to investigate whether the relationship between early life famine exposure and adulthood NAFLD risk was mediated by cardiometabolic traits. Overall, 7578 subjects aged 56·0 (sd 3·7) years in the Dongfeng–Tongji cohort were included and classified into late-exposed (1952–1954), middle-exposed (1954–1956), early-childhood-exposed (1956–1958), fetal-exposed (1959–1961) and non-exposed (1962–1966, reference) group according to the birth year. NAFLD was diagnosed by experienced physicians via abdominal B-type ultrasound inspection. Mediation analysis was used to evaluate the mediating effects of cardiometabolic traits. Compared with those non-exposed, after multivariable adjustment, participants in fetal-exposed group (OR: 1·37; 95 % CI 1·08, 1·73) had 37 % higher risk to develop NAFLD, and the overall childhood-exposed group had marginally significant association with NAFLD (OR: 1·39; 95 % CI 0·99, 1·94). Stratification analysis found the famine–NAFLD associations more evident in women and those born in areas severely affected by famine. Mediation analysis showed that cardiometabolic traits such as total cholesterol, TAG glucose index, γ-glutamyl transpeptidase, alkaline phosphatase and alanine aminotransferase mediated 6·7–22·2 % of the relation from famine exposure to higher NAFLD risk. Early life exposure to famine was related to increased adulthood NAFLD risk, and this relationship was partly mediated by cardiometabolic traits.