Look at the night sky and you are seeing only a small part of something much larger.
Our Sun belongs to the Milky Way, a galaxy containing hundreds of billions of stars. The Milky Way itself is only one galaxy among an enormous number spread throughout the observable universe.
Some galaxies are spirals. Others are elliptical or irregular. Some are rich in young stars and active star formation, while others contain mostly older stars.
None of them appeared fully formed.
Galaxies have histories. They formed, grew, merged, gained and lost gas, produced stars, and changed their structures over billions of years.
So how does a galaxy form?
The answer begins in the early universe.
How Did the First Structures Form?
After the Big Bang, the universe was extremely hot and dense. As it expanded, it cooled. Eventually, atoms formed and the universe became transparent to light.
But the early universe was not perfectly uniform.
Tiny differences in density existed. Some regions contained slightly more matter than others.
These differences were small, but gravity could amplify them.
A region containing slightly more matter had stronger gravitational attraction. It pulled in more matter, which strengthened its gravitational influence further.
Over enormous periods of time, these small differences grew into increasingly large structures.
This process eventually produced the large-scale structure of the universe, including the environments in which galaxies formed.
One of the most important ingredients was dark matter.
What Role Does Dark Matter Play?
Dark matter does not emit, absorb, or reflect light in the way ordinary matter does, so astronomers cannot observe it directly through ordinary telescopes.
Its gravitational effects, however, reveal its presence.
As the universe evolved, dark matter gathered into large structures called dark matter halos. These halos became important gravitational environments for galaxy formation.
Ordinary matter responded to the same gravitational structure.
Gas was pulled into these gravitational wells. It accumulated, became denser, and eventually cooled enough for stars to form.
Dark matter therefore provides an important gravitational framework for the visible structures we call galaxies.
Exactly what dark matter is remains unknown. Its nature is still one of the major unanswered questions in physics.
What Is the Cosmic Web?
Zoom far beyond individual galaxies and the universe begins to look very different.
Galaxies are not scattered randomly through space. They tend to occupy dense regions connected by enormous filaments, while vast low-density regions called voids contain relatively few galaxies.
Together, these structures form the cosmic web.
Dark matter plays a major role in creating this large-scale network. Galaxies develop within the denser parts of this structure and continue to interact with their surroundings as they evolve.
A galaxy is therefore part of a much larger gravitational system.
How Did the First Galaxies Form?
The early universe contained mostly hydrogen and helium, with very few heavier elements.
Gas gathered inside dark matter halos under gravity. As the gas became denser, it could radiate energy and cool. Eventually, some regions became dense enough for gravitational collapse to continue.
The first stars formed.
These early stars were probably very different from the Sun. Some may have been extremely massive and short-lived.
When they died, their radiation affected nearby gas and their explosions released heavier elements into space.
The universe began becoming chemically enriched.
Small systems containing dark matter, gas, and stars developed into primitive galaxies. These systems became building blocks for larger galaxies.
How Do Galaxies Grow?
Galaxy formation is not a single event.
A galaxy can grow by collecting additional gas, forming new stars, and merging with other galaxies.
Imagine a small protogalaxy containing dark matter, gas, and stars. Over time, more gas can fall into the system. Smaller galaxies can also interact with it or merge with it.
This process can happen repeatedly.
Small systems can therefore contribute to the growth of much larger galaxies over billions of years.
This is one reason galaxy formation is described as hierarchical. Large galaxies can contain stars and material that originated in smaller systems that merged in the past.
How Does Gas Become Stars?
Dark matter provides much of the gravitational framework, but stars form from ordinary matter.
Gas must become sufficiently dense for gravity to overcome the forces resisting collapse.
As gas falls into a developing galaxy, it gains energy and can become hot. At the same time, it can radiate energy away and cool.
As it cools, the gas can settle toward the central regions of the galaxy.
Angular momentum also becomes important.
Gas carrying angular momentum can begin rotating around the developing galaxy. Under suitable conditions, it can settle into a rotating disk.
Dense clouds within that disk can then collapse and form stars.
This connects galaxy formation directly with star formation. A galaxy is not simply a collection of stars. It provides the environment in which new generations of stars can continue to form.
Why Are Some Galaxies Spiral?
The Milky Way is a spiral galaxy.
It contains a large rotating disk of stars, gas, and dust, surrounded by a much larger dark matter halo. It also has a dense central bulge and a supermassive black hole called Sagittarius A*.
As gas settles into a rotating disk, stars can form within dense regions of that disk.
Young massive stars illuminate surrounding gas. Supernovae return energy and material to the interstellar environment.
The spiral pattern is dynamic.
Stars orbit the galaxy. Gas moves through the disk. Spiral structure can involve density waves and other evolving processes.
A spiral galaxy may look organized from a distance, but it is a constantly changing system.
Why Do Some Galaxies Become Elliptical?

Elliptical galaxies look very different from spiral galaxies.
They are generally smoother and more rounded. Many contain mostly older stars and relatively little cold gas compared with actively star-forming spiral galaxies.
Galaxy mergers can contribute to the development of these more spheroidal structures.
When two galaxies approach one another, their gravitational fields interact. Their shapes can become distorted, gas clouds can collide, and star formation can change.
Eventually, the galaxies can merge into a single system.
A major merger involving disk galaxies can produce a more spheroidal remnant. Repeated mergers can contribute to the growth of massive elliptical galaxies.
But mergers are only part of the explanation. Gas supply, star formation, feedback, black hole activity, mass, and environment all influence galaxy evolution.
A galaxy’s shape can therefore reveal something about its history.
What Role Do Supermassive Black Holes Play?
Many large galaxies contain supermassive black holes at their centers.
When one of these black holes actively accretes gas, the surrounding region can release enormous amounts of energy.
Radiation and jets can affect nearby gas.
This process can produce feedback, which may heat gas or drive outflows and influence how much material remains available for future star formation.
The relationship between galaxies and their central black holes is complex, and the detailed pathways through which supermassive black holes grow remain an active area of research.
Galaxy evolution and black hole evolution are closely connected.
How Do Supernovae Affect Galaxies?
Massive stars eventually die, and their explosions return energy and material to their surroundings.
Supernovae can heat gas, drive outflows, compress nearby clouds, and redistribute heavier elements.
Depending on the environment, these effects can encourage new star formation or make it more difficult for gas to collapse into new stars.
Supernovae therefore help regulate galaxy growth.
They also enrich the interstellar medium with material produced by earlier generations of stars.
Galaxy evolution is consequently both a gravitational and a chemical process.
Why Do Some Galaxies Stop Forming Stars?
A galaxy needs sufficiently cool gas to continue forming stars.
If its gas supply decreases, star formation can slow. Gas can also be expelled, become too hot to collapse, or be affected by the environment surrounding the galaxy.
Supernovae and active black holes can contribute energy to the surrounding gas.
A galaxy inside a dense cluster can also experience conditions very different from those surrounding an isolated galaxy.
When several of these processes combine, a galaxy can become relatively quiescent, with little ongoing star formation.
Other galaxies retain abundant cold gas and experience intense periods of star formation. These are sometimes called starburst galaxies.
How Do Galaxy Clusters Fit Into the Picture?
Galaxies rarely exist completely alone.
They can gather into groups, and groups can grow into galaxy clusters. Large clusters may contain hundreds or thousands of galaxies embedded within enormous dark matter halos.
The space between the galaxies can contain extremely hot gas.
Clusters occupy dense regions of the cosmic web and can be connected to other dense regions by enormous filaments.
This reveals the hierarchy of cosmic structure.
Individual stars exist within galaxies. Galaxies gather into groups and clusters. Groups and clusters form part of the much larger cosmic web.
The same gravitational process operates across these different scales.
How Can Astronomers See Galaxies in the Past?

There is a remarkable consequence of cosmic distance.
Light takes time to travel.
When astronomers observe a distant galaxy, they are seeing that galaxy as it existed when its light began traveling toward Earth.
A galaxy billions of light-years away is therefore observed at a much earlier stage of its history.
By studying galaxies at different distances, astronomers can compare different stages of cosmic evolution.
Some distant galaxies appear smaller, more irregular, or more actively star forming than many nearby mature galaxies.
Observations from powerful instruments such as the James Webb Space Telescope have allowed astronomers to study galaxies from very early periods in cosmic history.
The universe therefore gives astronomers a way to study galaxy evolution across time.
Why Do Astronomers Study Galaxies in Different Wavelengths?
No single type of light reveals everything about a galaxy.
Visible light shows stars.
Infrared observations can reveal older stellar populations and regions partly hidden by dust.
Radio observations can reveal cold gas.
X-rays can reveal extremely hot gas and energetic activity associated with black holes.
By combining observations across different wavelengths, astronomers can build a more complete picture of a galaxy.
Its stars reveal one part of its history.
Its gas reveals another.
Its dust, black hole, and energetic processes reveal still more.
What Determines the Shape of a Galaxy?

There is no single process that determines whether a galaxy becomes spiral, elliptical, or irregular.
Its history matters.
Its mass, gas supply, environment, mergers, star formation, and feedback all contribute.
A rotating disk with abundant cold gas can support ongoing star formation and spiral structure.
Major mergers can disrupt disks and contribute to more spheroidal systems.
Smaller galaxies can also be distorted by gravitational interactions.
A galaxy’s morphology is therefore partly a record of the events it has experienced.
When astronomers look at the shape of a galaxy, they are also looking at evidence of its past.
How Do Galaxies Form and Evolve?

The basic sequence begins with tiny density variations in the early universe.
Gravity amplifies those variations.
Dark matter gathers into halos and creates important gravitational structure. Ordinary matter follows that structure. Gas accumulates, cools, and becomes dense enough to form stars.
Small protogalaxies develop.
They grow through additional gas, star formation, and mergers.
Supernovae redistribute energy and elements. Supermassive black holes can influence surrounding gas through feedback. The environment can either support or limit further growth.
Over billions of years, these interacting processes produce the enormous variety of galaxies we observe today.
Some become rotating spirals.
Some become massive ellipticals.
Some remain irregular.
Others change substantially after mergers or periods of intense star formation.
There is no single moment when galaxy formation ends.
Galaxy evolution is ongoing.
Every Galaxy Carries a Cosmic History

The Milky Way was not created in its present form.
It assembled gradually from smaller structures. Gas accumulated. Stars formed. Older stellar populations became part of the growing galaxy. Its disk and central regions developed, while its dark matter halo continued to grow.
The process has not stopped.
The Milky Way interacts with smaller satellite galaxies and continues forming stars from available gas. It is also approaching the Andromeda Galaxy, and the two are expected to interact and eventually merge over billions of years.
The resulting system will be different from either galaxy today.
This is the larger story of galaxy formation.
The early universe contained tiny differences in density.
Gravity amplified them.
Dark matter provided structure.
Gas followed.
Stars formed.
Small galaxies developed.
Galaxies merged.
Supernovae enriched their surroundings.
Black holes influenced their environments.
And the cosmic web developed into the enormous structure we observe today.
A galaxy is therefore much more than a collection of stars.
Its stars, gas, dust, shape, black hole, and position within the cosmic web all contain clues about how it formed and changed.
When you look at a galaxy, you are looking at the result of billions of years of cosmic evolution.
And across the universe, that evolution is still happening.
Key Takeaways
- Galaxies formed from tiny density variations that existed in the early universe.
- Gravity amplified these variations and helped create increasingly large cosmic structures.
- Dark matter gathered into halos that provided an important gravitational framework for galaxy formation.
- Gas accumulated within these structures, cooled, and eventually formed stars.
- The first galaxies developed from smaller systems containing dark matter, gas, and stars.
- Galaxies grow through gas accretion, star formation, and mergers.
- Spiral and elliptical galaxies can develop different structures because of their gas, mergers, star formation, feedback, and evolutionary histories.
- Supernovae and supermassive black holes can influence galaxy evolution by changing the surrounding gas.
- Galaxies exist within the cosmic web of filaments, dense regions, clusters, and vast voids.
- Galaxy formation and evolution are ongoing processes that continue across the universe today.
Conclusion
A galaxy does not appear fully formed.
It emerges gradually from the structure of the early universe.
Tiny differences in density become amplified by gravity. Dark matter gathers into halos. Gas falls into these gravitational wells, cools, and begins forming stars. Small systems grow through additional gas and mergers, while supernovae, black holes, and their surrounding environment continually reshape them.
Over billions of years, these processes produce the enormous variety of galaxies we see today.
The Milky Way is one example.
It has a history of assembly, star formation, mergers, chemical enrichment, and gravitational interaction. It is still changing, just as galaxies across the universe continue to change.
So when you look at a galaxy, you are not seeing a static collection of stars.
You are seeing the visible result of billions of years of gravity, matter, star formation, and cosmic evolution.
Every galaxy carries a record of how the universe built it.
Explore more evidence-based explanations of space, astronomy, and the universe in CAVELYRA‘s Space collection.