Homophily structures human social networks: people tend to seek out or be attracted to those who share their preferences or values, and to generally expect social connections between similar people. Here, we probe the nature and extent of infants' homophilic thinking by asking whether infants can use information about other people's shared preferences in the absence of other socially relevant behaviors (e.g., their proximity or joint attention) to infer their affiliation. To do so, we present infants with scenarios in which two people either share a preference or have opposing preferences while varying (across studies) the degree to which those people engage in other socially relevant behaviors. We show that by 14 months of age, infants demonstrate clear inferences of homophily: they expect two people with a shared preference to be more likely to affiliate than two people without such similarity, even in the absence of other social behaviors that signal friendship. Although such cognition begins to emerge by 6-months, younger infants' inferences are bolstered by social behaviors that signal friendship. Thus, an abstract understanding that homophily guides third-party affiliation has its roots in the second year of life, and potentially earlier.