During animal development, tissues and organs are partitioned into compartments that do not intermix. This organizing principle is essential for correct tissue morphogenesis. Given that cell sorting defects during compartmentalization in humans are thought to cause malignant invasion and congenital defects such as cranio-fronto-nasal syndrome, identifying the molecular and cellular mechanisms that keep cells apart at boundaries between compartments is important. In both vertebrates and invertebrates, transcription factors and short-range signalling pathways, such as EPH/Ephrin, Hedgehog, or Notch signalling, govern compartmental cell sorting. However, the mechanisms that mediate cell sorting downstream of these factors have remained elusive for decades. Here, we review recent data gathered in Drosophila that suggest that the generation of cortical tensile forces at compartmental boundaries by the actomyosin cytoskeleton could be a general mechanism that inhibits cell mixing between compartments.