Humans have large social networks, with hundreds of interacting individuals. How does the brain represent the complex connectivity structure of these networks? Here we used social media (Facebook) data to objectively map participants' real-life social networks. We then used representational similarity analysis (RSA) of functional magnetic resonance imaging (fMRI) activity patterns to investigate the neural coding of these social networks as participants reflected on each individual. We found coding of social network distances in the default-mode network (medial prefrontal, medial parietal, and lateral parietal cortices). When using partial correlation RSA to control for other factors that can be correlated to social distance (personal affiliation, personality traits. and visual appearance, as subjectively rated by the participants), we found that social network distance information was uniquely coded in the retrosplenial complex, a region involved in spatial processing. In contrast, information on individuals' personal affiliation to the participants and personality traits was found in the medial parietal and prefrontal cortices, respectively. These findings demonstrate a cortical division between representations of non-self-referenced (allocentric) social network structure, self-referenced (egocentric) social distance, and trait-based social knowledge.