Several studies have documented the burden and risk factors associated with diarrhoea in low and middle-income countries (LMIC). To the best of our knowledge, the contextual and compositional factors associated with diarrhoea across LMIC were poorly operationalized, explored and understood in these studies. We investigated multilevel risk factors associated with diarrhoea among under-five children in LMIC. We analysed diarrhoea-related information of 796,150 under-five children (Level 1) nested within 63,378 neighbourhoods (Level 2) from 57 LMIC (Level 3) using the latest data from cross-sectional and nationally representative Demographic Health Survey conducted between 2010 and 2018. We used multivariable hierarchical Bayesian logistic regression models for data analysis. The overall prevalence of diarrhoea was 14.4% (95% confidence interval 14.2–14.7) ranging from 3.8% in Armenia to 31.4% in Yemen. The odds of diarrhoea was highest among male children, infants, having small birth weights, households in poorer wealth quintiles, children whose mothers had only primary education, and children who had no access to media. Children from neighbourhoods with high illiteracy [adjusted odds ratio (aOR) = 1.07, 95% credible interval (CrI) 1.04–1.10] rates were more likely to have diarrhoea. At the country-level, the odds of diarrhoea nearly doubled (aOR = 1.88, 95% CrI 1.23–2.83) and tripled (aOR = 2.66, 95% CrI 1.65–3.89) among children from countries with middle and lowest human development index respectively. Diarrhoea remains a major health challenge among under-five children in most LMIC. We identified diverse individual-level, community-level and national-level factors associated with the development of diarrhoea among under-five children in these countries and disentangled the associated contextual risk factors from the compositional risk factors. Our findings underscore the need to revitalize existing policies on child and maternal health and implement interventions to prevent diarrhoea at the individual-, community- and societal-levels. The current study showed how the drive to the attainment of SDGs 1, 2, 4, 6 and 10 will enhance the attainment of SDG 3.