Evidence on what people eat globally is limited in scope and rigour, especially as it relates to children and adolescents. This impairs target setting and investment in evidence-based actions to support healthy sustainable diets. Here we quantified global, regional and national dietary patterns among children and adults, by age group, sex, education and urbanicity, across 185 countries between 1990 and 2018, on the basis of data from the Global Dietary Database project. Our primary measure was the Alternative Healthy Eating Index, a validated score of diet quality; Dietary Approaches to Stop Hypertension and Mediterranean Diet Score patterns were secondarily assessed. Dietary quality is generally modest worldwide. In 2018, the mean global Alternative Healthy Eating Index score was 40.3, ranging from 0 (least healthy) to 100 (most healthy), with regional means ranging from 30.3 in Latin America and the Caribbean to 45.7 in South Asia. Scores among children versus adults were generally similar across regions, except in Central/Eastern Europe and Central Asia, high-income countries, and the Middle East and Northern Africa, where children had lower diet quality. Globally, diet quality scores were higher among women versus men, and more versus less educated individuals. Diet quality increased modestly between 1990 and 2018 globally and in all world regions except in South Asia and Sub-Saharan Africa, where it did not improve.