Structures in the universe such as stars, galaxies, and clusters of galaxies are thought to arise from the collapse of initially diffuse matter via gravity. Regions in space, which were slightly more dense in the early universe than the average density, started to contract as early as 100 million years after the Big Bang—the beginning of the universe. Small objects formed first and merged into larger and larger galaxies. Cosmologists have been using supercomputers to follow this origin of cosmic structure in sophisticated, three-dimensional modeling. These models follow how gas and the mysterious dark matter, which is thought to constitute 90 percent of all the mass in the universe, clump into galaxies. The model universes are remarkably successful in matching observations, and they give novel insights into the sequence of events that occurred before the universe attained its present complexity.