Background & Aims The pathway to non-alcoholic fatty liver disease (NAFLD) in adolescents may have its origins in adiposity gains, nutrition and sedentary lifestyle established during childhood. There is inadequate knowledge regarding the associations between infant nutrition and subsequent NAFLD. We examined the association of maternal factors and infant nutrition, with the subsequent diagnosis of NAFLD in adolescents. Methods Adolescents aged 17 years in the Western Australian Pregnancy (Raine) Cohort study had fatty liver assessment using liver ultrasound. Prospectively recorded data on maternal pregnancy and infant feeding were examined against a NAFLD outcome during late adolescence. Results NAFLD was diagnosed in 15.2% of the 1,170 adolescents examined. Ninety-four percent had been breastfed as infants. The duration of breastfeeding before starting supplementary milk was ⩾4 months in 54.4% and ⩾6 months in 40.6%. Breastfeeding without supplementary milk ⩾6 months (adjusted odds ratio [OR]: 0.64; 95% confidence interval [CI]: 0.43–0.94, p = 0.02), maternal pre-pregnancy obesity (adjusted OR: 2.29; 95% CI: 1.21–4.32, p = 0.01) and adolescent obesity (adjusted OR: 9.08; 95% CI: 6.26–13.17, p <0.001) were associated with NAFLD independent of a Western dietary pattern at 17 years of age. Adolescents with NAFLD who had been breastfed for ⩾6 months had a less adverse metabolic profile compared with adolescents breastfed for <6 months. Supplementary milk intake starting before 6 months was associated with a higher prevalence and ultrasound severity of NAFLD compared with intake starting after 6 months (17.7% vs. 11.2%, p = 0.003 and 7.8% vs. 3.4%, p = 0.005 respectively). Conclusion Though NAFLD is generally mediated through adiposity gains, breastfeeding for at least 6 months, avoidance of early supplementary formula milk feeding, and normal maternal pre-pregnancy BMI may reduce the odds of a NAFLD diagnosis during adolescence. Lay summary Non-alcoholic fatty liver disease (NAFLD) is a common liver disorder in which there is too much fat in the liver of people who do not consume excessive amounts of alcohol. In this large study, we found that infants who consumed breast milk for less than 6 months before starting infant formula milk, infants who were obese as teenagers or had mothers who were obese at the start of pregnancy, were much more likely to have NAFLD at 17 years of age. Based on our findings we consider that reducing the risk of NAFLD in teenagers needs to start before birth, by encouraging normal body mass index before pregnancy, as well as breastfeeding without infant formula milk consumption for the first 6 months of life.