Adults use cultural markers to discern the structure of the social landscape. Such markers may also influence the social preferences of young children, who tend to conform to their own group and prefer others who do so. However, the forces that propel these preferences are unknown. Here, we use social preferences based on music to investigate these forces in four- and five-year-old children. First, we establish that children prefer other children whose favorite songs are familiar to them. Then we show that this effect depends on shared knowledge: children both prefer others who know songs they themselves know, and avoid others who know songs they do not know, irrespective of the target children’s liking of the songs. These results suggest that young children have a remarkably selective sensitivity to shared cultural knowledge. Shared knowledge may be a powerful determinant of children’s social preferences, both because it underpins effective communication and because it is conveyed by others through social interactions and therefore can serve as a marker of social group identity.