Ultracompact dwarf galaxies (UCDs) are among the densest stellar systems in the Universe. With typical masses of 10^7 to 10^8 solar masses and half-mass radii between 10 to 100 pc they are more than a factor 1000 denser than dwarf galaxies of the same mass. They also show evidence for elevated mass-to-light ratios, which could be due to the presence of massive black holes or unusual stellar IMFs as a result of their extreme densities. While the first UCD was discovered only 15 years ago, hundreds of of them have meanwhile been found in nearby galaxy clusters, making it all the more important to understand where UCDs come from. In my talk I will discuss our current knowledge about UCDs and the various formation channels that have been suggested for them, and explain what we can learn from UCDs about the early evolution of galaxies.