Why do diverse groups outperform homogeneous groups in some settings, but not in others? We show that while diverse groups experience more frictions than homogeneous ones, they are also less conformist. Homogeneous groups minimize the risk of miscoordination, but they may get stuck in an inefficient equilibrium. Diverse groups may fail to coordinate, but if they do, they tend to attain efficiency. This fundamental tradeoff determines how the optimal level of diversity varies with social and economic factors.When it is vitally important to avoid miscoordination, homogeneous groups are optimal. However, when it is critical to implement new and efficient practices, diverse groups perform better. * Part of the material incorporated here was previously in a paper entitled "A belief-based theory of homophily" by the same authors (Kets and Sandroni, 2015a). We thank David Ahn, Larbi Alaoui, Sandeep Baliga, Vincent Crawford, Vessela Daskalova, Georgy Egorov, Tim Feddersen, Matthew Jackson, Wouter Kager, Rachel Kranton, George Mailath, Niko Matouschek, Friederike Mengel, Rosemarie Nagel, Alessandro Pavan, Antonio Penta, Nicola Persico, Debraj Ray, Yuval Salant, Larry Samuelson, Paola Sapienza, Rajiv Sethi, Eran Shmaya, Andy Skrzypacz, Jakub Steiner, Colin Stewart, Jeroen Swinkels, and numerous seminar audiences and conference participants for helpful comments and stimulating discussions.