Solar System SimulatorAccuracy & sources

Galaxy Simulator

Two spirals collide

Bodies enlarged for visibility

Drag to orbit Scroll to zoomDrag to orbit Pinch to zoomHow to use

View & tools

Auto adapts to your device. High is sharper but may run slower. Pictures save at full resolution in either mode.

Drag to orbit. Pinch or scroll to zoom. H hides controls.

Try this

Share this scene

The link holds the whole scene: bodies, speeds, time and view. It opens paused. The scene sits after the # in the address, which browsers do not send to any website.

Your gravity scenes

Scenes stay on this device. Save a file to keep a copy or share it.

A scene includes bodies, velocities, particles, units, time and view settings. Opened scenes start paused, with each trail drawn from the scene's own past.

Add a body

Then clickThen tap in space to put it in orbit around what pulls on it hardest (close to a planet, that planet), or drag to launch it: the arrow sets its speed.

Setting up the scene…

Collide galaxies and watch what gravity does to their stars.

The scenes

Choose a scene from the list. Each one opens at its starting view; drag to look around, scroll or pinch to zoom, and use the time controls to pause, change speed or run time backward. At the opening speed one second is 10 million years (5 million in the lone spiral).

Scene What happens What to watch for
Two spirals collide Two equal galaxies swing past each other, 9 kpc apart at their closest, about 100 million years in. A long tail grows out of the far side of each galaxy, and a bridge of stars joins them.
Set up your own You choose the masses, the closest approach, the spins and the lean. Which choices make the longest tails.
A small galaxy passes by A companion with three tenths of the spiral's mass passes 14 kpc from its centre, just outside the disc, in the direction the disc turns. A bridge reaches toward the companion and a tail leaves the opposite side.
The same pass, against the spin The same companion on the same path, with the spiral turning the other way. Almost nothing: the disc stays whole.
A bullseye makes a ring A compact galaxy drops through a spiral and passes about half a kiloparsec from its centre, 110 million years in. The disc squeezes inward, then a ring spreads out from the middle.
A spiral winds up One galaxy, left alone. Two open arms wrap tighter with each turn until they are rings.

On a phone, swipe the scene list for more scenes and open Details for the scene's description and the setup menus.

Set up your own encounter

Choose Set up your own, then use the menus in the scene's details. Each change starts the encounter again from the beginning.

  • Second galaxy's mass: equal to the first, half, or a quarter. A light companion barely moves the heavy galaxy and is torn up more itself.
  • Closest approach: 6 kpc sends the discs through each other, 12 kpc makes them graze, and 20 kpc is a wide pass that leaves gentler arms.
  • Spins: each disc turns with the orbit or against it. Tails come from discs that turn with the orbit.
  • Lean: flat in the plane of the orbit, or tipped 30° or 60°, one disc each way. Flat discs make the thinnest, longest tails.

Real galaxies to compare

  • The Antennae (NGC 4038 and 4039) are two spirals in the middle of a collision, named for their two long tails. They are one of the four pairs Toomre and Toomre reconstructed in 1972.
  • The Whirlpool (M51) has a small companion, NGC 5195, at the tip of one arm. NASA describes the companion as passing behind the Whirlpool and gliding past it for hundreds of millions of years.
  • The Cartwheel, about 500 million light-years away, got its shape from a high-speed collision with a smaller galaxy. NASA puts the age of its outer ring's expansion at about 440 million years.
  • The Milky Way and Andromeda are approaching each other. Whether they merge is open: see the questions below.

What the simulation leaves out

  • Stars do not pull on each other or on the cores. Only the cores have mass. This is why thousands of stars run smoothly; it suits the thin outer discs that tails are drawn from, where stars are too spread out to steer each other.
  • No dark matter halos, so no merging. The cores keep orbiting where real galaxies would sink together.
  • No gas. Real collisions squeeze gas clouds and set off bursts of star formation; the pink and blue points here are colouring, not new stars.
  • Each core is one mass, softened over 1.2 kpc. A real galaxy's mass is spread through its disc and halo, so its outer stars circle faster than they do here.
  • Scales are typical, not measured. The large galaxy is 10¹¹ solar masses with a disc 11 kpc in radius. No scene is a fitted model of a named pair.

The cores move under Newton's gravity with the same integrator as the gravity simulator, where the method and its tests are described.

Sources

Toomre and Toomre, "Galactic Bridges and Tails", The Astrophysical Journal 178, 623 (1972). Lynds and Toomre, "On the interpretation of ring galaxies: the binary ring system II Hz 4", The Astrophysical Journal 209, 382 (1976). Lin and Shu, "On the Spiral Structure of Disk Galaxies", The Astrophysical Journal 140, 646 (1964). Sawala and others, "No certainty of a Milky Way–Andromeda collision", Nature Astronomy 9, 1206 (2025). NASA Science: "Apocalypse When? Hubble Casts Doubt on Certainty of Galactic Collision" (2 June 2025), "Webb Captures Stellar Gymnastics in the Cartwheel Galaxy", and "Messier 51".

Questions

How does this galaxy simulator work?

Each galaxy's mass sits in a softened central core, and the cores pull on each other and on every star. The stars feel that pull but do not pull back. Alar and Juri Toomre used this restricted method in 1972 to show that the bridges and tails of interacting galaxies are the work of tides, and it runs fast enough for 12,000 stars in a browser.

Why don't the two galaxies merge?

Real galaxies sit in large halos of dark matter. When two galaxies pass, the halos drag on each other, the pair loses orbital energy and falls together within a few passes. Here each galaxy is a single mass with no halo, so nothing takes that energy away: the cores keep orbiting, pass again, and strip more stars each time.

Why does the direction of spin matter?

When a disc turns the same way the companion passes, stars on the near side keep pace with it for a long time, so its pull adds up and draws them into a bridge and a tail. When the disc turns the other way, each star sweeps past the companion quickly and is pulled first one way and then the other. Run the two passing scenes one after the other to see the difference.

What makes a ring galaxy?

A compact galaxy falling almost straight through the middle of a disc. As it passes, its gravity pulls the disc's stars inward together; once it has gone they swing back out, bunching into a ring that spreads outward. Roger Lynds and Alar Toomre described this in 1976, and the Cartwheel galaxy is the best-known example.

Will the Milky Way collide with Andromeda?

It is no longer treated as certain. A 2025 study in Nature Astronomy, using Hubble and Gaia measurements, ran 100,000 simulations and found close to an even chance that the two do not merge within the next 10 billion years, and about a 2% chance of a head-on collision in 4 to 5 billion years.

Are spiral arms always made of the same stars?

No. In the lone spiral scene the arms are fixed sets of stars, and they wind into tight rings within a few turns, because stars near the centre circle faster than stars farther out. Real spirals have turned many more times than that and still have open arms, which is why astronomers describe their arms as waves of crowding that stars pass through.