Unsafe sanitation practices are a major source of environmental pollution and are a leading cause of death in countries of the Global South. One of the most successful campaigns to eradicate open defecation is “Community-Led Total Sanitation” (CLTS). It aims at shifting social norms towards safe sanitation practices. However, the effectiveness of CLTS is heterogeneous. Based on social identity theory, we expect CLTS to be most effective in communities with stronger social identification, because in these communities individuals should rather follow social norms. We conducted a cluster-randomized controlled trial with 3,216 households in 132 communities in Ghana, comparing CLTS to a control arm. Self-reported open defecation rates and social identification were assessed pre-post. Generalized Estimating Equations showed that CLTS achieved lower open defecation rates compared to controls. This effect was significantly stronger for communities with stronger average social identification. The results confirm the assumptions of social identity theory. They imply that pre-existing social identification needs to be considered for planning CLTS, and strengthened beforehand if needed.