The remarkable ecological and demographic success of humanity is largely attributed to our capacity for cumulative culture1,2,3. The accumulation of beneficial cultural innovations across generations is puzzling because transmission events are generally imperfect, although there is large variance in fidelity. Events of perfect cultural transmission and innovations should be more frequent in a large population4. As a consequence, a large population size may be a prerequisite for the evolution of cultural complexity4,5, although anthropological studies have produced mixed results6,7,8,9 and empirical evidence is lacking10. Here we use a dual-task computer game to show that cultural evolution strongly depends on population size, as players in larger groups maintained higher cultural complexity. We found that when group size increases, cultural knowledge is less deteriorated, improvements to existing cultural traits are more frequent, and cultural trait diversity is maintained more often. Our results demonstrate how changes in group size can generate both adaptive cultural evolution and maladaptive losses of culturally acquired skills. As humans live in habitats for which they are ill-suited without specific cultural adaptations11,12, it suggests that, in our evolutionary past, group-size reduction may have exposed human societies to significant risks, including societal collapse13.