Look up on a clear, dark night and the Milky Way arches overhead: 200–400 billion stars, bound together by gravity into a structure 100,000 light-years across, slowly rotating through the universe. Below it, through a telescope, lie billions more galaxies, each an island universe of stars. Understanding how galaxies form means tracing this structure back to the early universe.
How did this come to be? How did the smooth, nearly uniform plasma of the early universe give rise to the extraordinary structures we observe today: spiral galaxies, elliptical giants, the vast cosmic web of filaments and voids?
The answer is a cosmic game of gravity and gas, played over nearly 14 billion years on a stage built by dark matter.
How Galaxies Form: The Universe Was Not Always Lumpy

Immediately after the Big Bang, the universe was an extraordinarily hot, dense plasma of quarks, leptons, and photons, far too energetic for atoms to exist. It was also extraordinarily smooth. Measurements of the cosmic microwave background (CMB), the afterglow of the Big Bang, observable today as microwave radiation: show that the early universe was uniform to about 1 part in 100,000.
But not perfectly uniform. Quantum fluctuations, the unavoidable fuzziness of quantum mechanics, imprinted tiny density variations on the early universe. During the era of cosmic inflation (a brief period of exponential expansion in the first fraction of a second), these quantum-scale fluctuations were stretched to cosmic scales, becoming the seeds of all future structure.
These tiny overdensities, regions very slightly denser than average, were the seeds from which everything grew.
Dark Matter: The Invisible Scaffolding
Gravity would eventually amplify these density fluctuations into stars and galaxies. But ordinary matter, the protons, neutrons, and electrons that make up everything we can touch and see, couldn’t do it alone.
The problem is that ordinary matter was coupled to photons (light) in the early universe. The pressure from photons resisted gravitational collapse, preventing density fluctuations from growing. Galaxy formation couldn’t begin until about 380,000 years after the Big Bang, when the universe cooled enough for neutral hydrogen atoms to form and the photons decoupled.
Dark matter solved this problem. Dark matter doesn’t interact with photons, it only feels gravity. So dark matter could begin collapsing under its own gravity long before ordinary matter could, unimpeded by photon pressure. By the time ordinary matter decoupled from photons, dark matter had already formed the gravitational scaffolding, halos, into which ordinary matter could fall.
This is the hierarchical structure formation model: dark matter formed small halos first, which merged into progressively larger structures, with ordinary matter following the gravitational wells carved by dark matter.
Evidence for this picture comes from multiple independent sources: gravitational lensing observations, galaxy clustering statistics, CMB anisotropy patterns, and computer simulations that reproduce the large-scale structure of the observed universe with remarkable fidelity.
Hierarchical Structure Formation: Why Small Galaxies Came First
Structure formation in the universe was hierarchical, small things formed before large things.
The first structures to collapse under gravity were dark matter minihalos: objects roughly the mass of a globular cluster, containing tens of thousands to millions of solar masses. These merged into larger halos, and ordinary baryonic matter fell into them. In the densest regions, the gas cooled and condensed, eventually reaching the densities and temperatures required to ignite nuclear fusion: the first stars were born.
Population III stars: the first generation of stars, formed from nearly pure hydrogen and helium (the only elements the Big Bang produced). Without heavy elements (metals in astronomical parlance), they could cool less efficiently, leading to far more massive stars than typical today, often hundreds of solar masses, and possibly up to a thousand. These behemoths burned through their fuel rapidly, exploded as supernovas and pair-instability supernovas, seeding the universe with the first heavy elements.

The first galaxies began to assemble within the first billion years after the Big Bang: small, irregular clumps of stars in dark matter halos. The James Webb Space Telescope has now observed galaxies at redshifts above 10, galaxies that existed when the universe was less than 500 million years old, revealing that early galaxies were forming stars at remarkable rates. We have not yet directly observed the very first stars (theoretically at redshifts beyond JWST’s current reach), but the telescope is pushing toward that frontier with each observation.
Galaxy Mergers: Building the Large from the Small
Galaxies did not form in isolation. Dark matter halos merged, bringing their galaxies with them. Galaxy mergers are one of the most important processes shaping galactic structure.
When two dark matter halos (with their embedded galaxies) fall together, the merger is violent and prolonged. The galaxies interact gravitationally: their stars swirl into chaotic orbits, tidal forces draw out long streamers of stars and gas called tidal tails, and intense bursts of star formation are triggered as gas clouds are compressed by the collision.
The outcome of a merger depends on the mass ratio of the participants:
- Major mergers (roughly equal mass): result in dramatic morphological transformation, typically producing an elliptical galaxy
- Minor mergers (a large galaxy absorbing a much smaller one): can trigger star formation bursts and distort the larger galaxy without wholesale reorganization
The Milky Way itself has grown through numerous mergers. Gaia spacecraft data have revealed the remnants of multiple past mergers encoded in the motions and chemical compositions of our galaxy’s stars. The Gaia-Sausage-Enceladus event, a major merger about 10 billion years ago, contributed a substantial fraction of the Milky Way’s stellar halo and some of its thick disk. Your left hand contains atoms forged in a galaxy that merged with the Milky Way 10 billion years ago.
In 4–5 billion years, the Milky Way and the Andromeda Galaxy (M31) will merge in a spectacular collision, ultimately forming a large elliptical or lenticular galaxy sometimes called “Milkomeda.”
Why Galaxies Have Different Shapes
The diverse morphologies of galaxies, spirals, ellipticals, irregulars, lenticulars, are the result of their different merger and star formation histories.
Spiral Galaxies
Spiral galaxies like the Milky Way have a central bulge of older stars, a flat disk with spiral arms, and an extended halo of stars and globular clusters. The disk forms when gas with angular momentum falls into a dark matter halo and settles into rotation before forming stars.
Spiral arms are density waves: like a traffic jam moving through a highway, the jam itself moves slower than the cars. As gas clouds pass through the compressed region of a spiral arm, they are triggered to collapse and form new stars. The blue, bright, massive stars born in spiral arms illuminate them, making the arms visible before those stars explode.
Spiral structure requires the disk to be relatively undisturbed. Galaxies that have experienced recent major mergers have disrupted disks and lose their spiral structure.
Elliptical Galaxies
Elliptical galaxies are smooth, featureless spheroids with little gas, dust, or ongoing star formation. They consist primarily of old, red stars. Most large ellipticals are the products of major mergers between spiral galaxies: the violent merger randomized the ordered disk orbits into disordered spheroidal motions, and the gas supply was consumed or expelled in the process.
The largest galaxies in the universe, brightest cluster galaxies at the centers of galaxy clusters, are monstrous ellipticals assembled by successive mergers over billions of years, some containing trillions of stars.
Irregular Galaxies
Irregular galaxies lack the organized structure of spirals or ellipticals. They are typically small, gas-rich, actively star-forming, and often distorted by interactions with larger neighbors. The Large and Small Magellanic Clouds, satellite galaxies of the Milky Way, are irregulars.
Many high-redshift galaxies observed by JWST are irregular or clumpy, reflecting the chaotic conditions of early cosmic structure formation.
The Role of Supermassive Black Holes
At the center of virtually every large galaxy lurks a supermassive black hole, ranging from millions to billions of solar masses. These objects are not incidental. They play a crucial role in galaxy formation through active galactic nucleus (AGN) feedback.

When material falls onto a supermassive black hole, the infalling matter heats up and radiates enormous energy, sometimes outshining the entire galaxy. This is a quasar. The energy output from the AGN can drive powerful winds and jets that heat and expel gas from the galaxy, quenching star formation.
This feedback mechanism explains why the most massive galaxies, those with the most massive central black holes, stopped forming stars at relatively early cosmic times. The black hole grew, heated the gas reservoir, and shut off the fuel supply for further star formation. Galaxies in this state are called “red and dead”: populated by old, red stars with no new star formation.
The correlation between supermassive black hole mass and the velocity dispersion of the galaxy’s central bulge (the M-sigma relation) is puzzling: how does a black hole that is only about 0.1% of the bulge’s mass exert such precise control over the entire bulge’s motion? The leading explanation is that black hole growth and galaxy growth are closely coupled through AGN feedback: the same winds that shut off star formation also regulate the bulge’s dynamics, leaving a telltale imprint on the stars’ velocities.
What the James Webb Space Telescope Is Telling Us
The launch of JWST in 2021 has transformed our view of early galaxy formation. JWST can observe galaxies at higher redshifts (earlier cosmic times) with greater clarity than any previous telescope, and its observations have produced some surprises.
Early JWST results revealed several massive, well-formed galaxies at redshifts above 10: epochs when the universe was less than 500 million years old. Some of these galaxies appear to have formed stars very rapidly, potentially more rapidly than standard models predicted. Their existence has prompted revisions to our models of early star formation efficiency and gas cooling.
JWST has also revealed the detailed morphology of high-redshift galaxies, showing disk structures and spiral-like features in galaxies far earlier than expected, suggesting that organized, rotating disk galaxies can form surprisingly quickly.
The picture is being refined in real time.
Galaxy Formation and the Large-Scale Structure
Individual galaxies don’t exist in isolation. They are embedded in the cosmic web: a vast network of filaments, sheets, and voids that extends across the observable universe. Galaxy clusters and superclusters form at the intersections of filaments; voids occupying hundreds of millions of light-years are almost devoid of galaxies.
This large-scale structure is the direct descendant of the primordial density fluctuations imprinted during inflation. The specific pattern of galaxy clustering, the power spectrum, which includes the crucial baryon acoustic oscillation (BAO) feature acting as a standard ruler, is one of the most powerful probes of cosmological parameters, including the density of dark matter, dark energy, and the universe’s geometry.
Around 5–6 billion years ago, dark energy began accelerating cosmic expansion, which halts the growth of large-scale structures and prevents many potential mergers, explaining why galaxies are not all merging together today.
The Big Picture: From Quantum Fluctuations to the Cosmos
Galaxy formation, from the quantum fluctuations of the inflationary epoch to the grand spiral arms visible in the night sky, is one of the most spectacular processes in the universe: a 13.8-billion-year story of gravity, dark matter, gas, light, and the relentless assembly of structure from near-perfect uniformity.
What began as tiny density ripples, variations of just 1 part in 100,000 in the primordial plasma, grew under the gentle pull of dark matter gravity into the first minihalos, then merged into galaxies, clusters, and superclusters spanning hundreds of millions of light-years. The same quantum uncertainties that govern the subatomic world gave rise to the cosmic web that surrounds us.
As telescopes like JWST continue to peer deeper into cosmic time, and as surveys map ever more of the large-scale structure, we are writing the final chapters of this remarkable story.
Sources
- Peebles, P.J.E. (1982). Large-scale background temperature and mass fluctuations due to scale-invariant primeval perturbations. Astrophysical Journal Letters, 263, L1–L5.
- Springel, V. et al. (2005). Simulations of the formation, evolution and clustering of galaxies and quasars. Nature, 435, 629–636.
- Labbe, I. et al. (2023). A population of red candidate massive galaxies ~600 Myr after the Big Bang. Nature, 616, 266–269.
- NASA James Webb Space Telescope. (2023). Early Universe.
How did galaxies form after the Big Bang?
Galaxies formed from tiny density variations in the early universe, amplified by gravity over billions of years, with dark matter providing the gravitational scaffolding for gas to collapse and form stars.
What role did dark matter play in galaxy formation?
Dark matter provided the gravitational framework that attracted ordinary matter, allowing gas to clump and eventually form galaxies within dark matter halos.
How do spiral galaxies like the Milky Way form?
Spiral galaxies form when gas within a dark matter halo collapses into a rotating disk, where density waves and star formation create the characteristic spiral arms.
What is the cosmic web in galaxy formation?
The cosmic web is the large-scale structure of the universe, composed of filaments of galaxies and dark matter separated by voids, shaped by gravity from initial density fluctuations.
How do elliptical galaxies differ from spiral galaxies in formation?
Elliptical galaxies typically form through mergers of smaller galaxies, which randomize stellar orbits and produce a smooth, spheroidal shape with little gas or new star formation.
Further reading: Galaxy formation and evolution on Wikipedia
