Although sociodemographic characteristics such as immigrant background and low socioeconomic status have been found to increase the risk for peer rejection, it remains unclear whether rejection in school settings primarily occurs between different-characteristic peers or is also driven by same-characteristic peers, nor whether these types of processes are moderated by classroom composition. Building on person-group dissimilarity theories, we address this gap in the literature using a large sample of 4,215 Swedish students (aged 14-15) in 201 eighth grade classes. Sociometric data provide information on received rejection nominations and rejection networks in school classes. Five characteristics are examined at the student- and classroom-levels: gender, immigration background, household income, parental education, and cognitive ability. Information on sociodemographic characteristics is drawn from linked survey and administrative population registers. A two-pronged empirical strategy is used, using both multilevel random effects models and Exponential Random Graph Models. We find that multiple characteristics are associated with peer rejection, and classroom composition moderates how these characteristics are associated with the extent to which students are rejected and reject classmates who are different to themselves.