Interactive N-Body Gravity Simulator

About Gravity Simulator

A 3D Gravitational Sandbox for Exploring Celestial Mechanics & Orbital Dynamics

Gravity Simulator (also known as Harmony of the Spheres) is a browser-native, open-source 3D Newtonian n-body orbital simulator. Every celestial body continuously exerts gravitational pull on every other body—from the planets and moons of our Solar System to 4,390+ confirmed exoplanetary systems, interplanetary spacecraft, supermassive black holes, and colliding galaxies whose starry disks shear into breathtaking tidal bridges.

4,543Ready-to-Run Astronomical Simulations
14Precision Numerical Integrators
50+Celestial Body Templates & Tools
100%In-Browser WebGL — No Install Required
Physics Engine

The Universe in Motion: True N-Body Physics

Many space visualizers rely on simplified Keplerian two-body approximations that draw static elliptical paths. Gravity Simulator solves the true gravitational n-body problem by computing the instantaneous gravitational acceleration between every pair of masses at every simulation step under Newton's universal law of gravitation:

Full Mutual Perturbations

Because all masses pull on one another, complex nonlinear behaviors emerge naturally: Laplace mean-motion resonances (such as the 4:2:1 resonance of Jupiter's Galilean moons), Kozai-Lidov orbital oscillations, secular orbital drift, and chaotic multi-body ejections.

High-Order Numerical Integration

Choose from fourteen numerical integrators spanning 4th-order Runge-Kutta (RK4), energy-conserving symplectic methods like PEFRL and Velocity Verlet for long-term stability, and adaptive time-stepping algorithms with configurable error tolerances.

Inelastic Collisions & Accretion

When two celestial bodies collide, the simulation dynamically detects physical surface overlap, merges the bodies while strictly conserving total linear momentum, and propagates dynamic impact shockwaves across the surviving planet's surface.

Scenario Library

Explore 4,540+ Curated Simulations

Every simulation in Gravity Simulator is ready to launch instantly in your browser. Orbital states are derived from the NASA Exoplanet Archive, NASA JPL HORIZONS ephemerides, and published astronomical research papers. Select any category below to begin exploring:

34 Scenarios

Solar System

Simulate our local cosmic neighborhood using NASA JPL Horizons ephemerides: the eight planets, resonant Galilean and Saturnian moons, near-Earth asteroids, comets, co-orbitals, and hyperbolic interstellar visitors like ʻOumuamua and Borisov.

JPL HorizonsGalilean MoonsLagrange PointsInterstellar
Explore Solar System →
45 Scenarios

Spaceflight

Relive historic and active space exploration under true celestial gravity. Trace Apollo 11's translunar free-return loop, interplanetary Hohmann transfers, New Horizons, 20 close Juno flybys of Io and Europa, and active 2026 satellite fleets at Mars and the Moon.

Apollo 11Gravity AssistsJuno FlybysActive Fleets
Explore Spaceflight →
17 Scenarios

What-If Scenarios

Unleash cosmic chaos in a gravitational sandbox: drop the Moon into Earth, swap Jupiter and Saturn, test the five-planet Nice model migration, pit Earth against Saturn's rings, or trigger a rogue red-dwarf star flyby.

Cosmic ChaosTidal DisruptionNice ModelPlanet Nine
Explore What-If Scenarios →
4,397 Scenarios

Exoplanetary Systems

Explore alien solar systems from the NASA Exoplanet Archive. From single-planet systems to the tightly packed, resonant Earth-sized worlds of TRAPPIST-1 and the eight-planet array of Kepler-90, simulated with published orbital elements.

NASA ExoplanetsTRAPPIST-1Habitable ZonesResonances
Explore Exoplanetary Systems →
24 Scenarios

Black Holes

Push physics to the limit around extreme gravity wells: supermassive black hole Sagittarius A* with the high-velocity inner S-stars, relativistic microquasars like SS 433, Cygnus X-1, and dormant Gaia black holes (Gaia BH1, BH2, and BH3).

Sagittarius A*Event HorizonS-StarsGaia BH3
Explore Black Holes →
13 Scenarios

Galaxies & Globular Clusters

Experience macro-evolution across cosmic time. Simulate Sa through Sc spirals, barred galaxies, lenticulars, ellipticals, shell ripples, halo globular clusters, and grazing galactic collisions that tear out sweeping tidal bridges.

Colliding GalaxiesTidal TailsBarred SpiralsGlobular Swarms
Explore Galaxies & Globular Clusters →
11 Scenarios

N-Body Choreographies

Discover mesmerizing, periodic mathematical solutions to the gravitational n-body problem where equal masses trace closed curves without a central body: the Chenciner–Montgomery figure-eight, pentagram, hexagon, and Star of David.

Figure-EightPeriodic SolutionsHarmonic SymmetryNewtonian Balance
Explore N-Body Choreographies →
2 Scenarios

Stars & Multiple Systems

Explore our closest stellar neighbors: the Alpha Centauri A–B binary swinging through an 80-year eccentric orbit, and Hadar (Beta Centauri), a luminous hierarchical triple system of massive B-type stars.

Alpha CentauriHadarHierarchical TriplesMutual Barycenters
Explore Stars & Multiple Systems →
Interactive Tools

A Complete Celestial Sandbox Toolkit

Gravity Simulator is not just an astronomical observatory—it is an interactive laboratory. Tweak orbital paths, add rogue stars, freeze reference frames, and manipulate the laws of physics with an array of real-time tools:

True N-Body Newtonian Gravity

Every body in the scene continuously exerts a gravitational force on every other body. Mutual gravitational perturbations produce natural orbital resonances, Kozai-Lidov cycles, precession, and chaotic ejections.

14 Precision Numerical Integrators

Choose from fourteen numerical integration schemes: high-order Runge-Kutta (RK4, Cash-Karp 5/4, Fehlberg 8/7), energy-conserving symplectic methods (PEFRL, Velocity Verlet, Forest-Ruth), and adaptive time-stepping.

Add & Modify Celestial Bodies

Inject new bodies on the fly using fifty real-object templates (stars, planets, moons, asteroids, and black holes), or specify custom masses, radii, positions, and velocity vectors directly in the live simulation.

Rotating & Co-Rotating Reference Frames

Lock the camera frame to any body or system barycenter, or activate a co-rotating frame to fix a planet's position and reveal intricate non-inertial motions like horseshoe orbits, quasi-satellite loops, and tadpole libration.

Procedural WebGL Surface Shaders

Celestial bodies render in real-time 3D with procedural GLSL shaders. Continental shorelines, oceans, polar ice, desert dunes, cloud layers, volcanic lava lakes, and gas giant cloud bands adapt dynamically to stellar flux and mass.

Dynamic Particle Ring Systems

Spawn tens of thousands of gravitationally interacting ring particles around any world. Observe shepherd moons clear sharp gaps, generate spiral density waves, and induce ring warps.

Inelastic Collisions & Mergers

When orbital periapses intersect physical radii, bodies merge with strict momentum conservation. Realistic collision shockwaves dynamically ripple across the surviving body's planetary surface in real time.

Barycenter & Lagrange Points (L1–L5)

Compute and display the exact gravitational center of mass (barycenter) and the five Lagrangian equilibrium points in real time for any two interacting bodies in the simulation.

Flexible 3D Camera Controls

Freely orbit, pan, and zoom through space with logarithmic depth buffering. Track spacecraft, follow planet surfaces, or step back for an expansive light-year perspective on galactic discs.

Custom Scenario Builder

Design your own star system from scratch. Choose stellar types, populate planetary architectures, pick numerical integrators, set gravitational constants, and test the long-term stability of your creation.

Galaxy & Cluster Particle Sims

Explore disc galaxies, barred spirals, and merger scenarios with thousands of gravitationally coupled particles, dedicated galaxy integrators, and camera views from kiloparsecs to light-years.

Browser Storage & Instant Reset

Save customized scenario configurations directly to your browser's local storage to resume your experiments anytime. Reset any simulation back to its initial astronomical state with one click.

Scientific Accuracy

Real Astronomical Data Sources

We believe gravitational simulations should reflect reality. Whenever possible, our celestial architectures and spacecraft trajectories are generated directly from authoritative scientific repositories and peer-reviewed astrophysical literature:

NASA JPL HORIZONS

The Jet Propulsion Laboratory's HORIZONS On-Line Ephemeris System provides high-precision 3D cartesian position and velocity state vectors for our Solar System planets, moons, asteroids, comets, and historic spacecraft missions.

NASA Exoplanet Archive

Maintained by Caltech and IPAC, the NASA Exoplanet Archive serves as the foundation for our 4,397 exoplanetary systems, supplying verified semi-major axes, orbital eccentricities, orbital periods, and stellar masses.

Published Astrophysical Research

Black hole parameters and multi-star systems are calibrated against modern academic literature, including Gillessen et al. (2017) for the Galactic Center S-stars around Sagittarius A*, Miller-Jones et al. (2021) for Cygnus X-1, and Gaia DR3 astrometry.

Common Questions

Frequently Asked Questions

Everything you need to know about how Gravity Simulator models orbital dynamics, numerical physics, and cosmic architectures in the browser:

What is Gravity Simulator (Harmony of the Spheres)?

Gravity Simulator is a free, web-based 3D physics sandbox that models celestial mechanics using true Newtonian n-body gravitation. Unlike conventional planetarium apps that render fixed geometric Keplerian ellipses, Gravity Simulator computes the live mutual gravitational pull between every body in the scene at every time-step, accurately capturing orbital resonances, tidal stripping, and gravitational chaos.

Where does the orbital and astronomical data come from?

All Solar System planetary, lunar, asteroid, comet, and spacecraft states are sourced from NASA JPL HORIZONS high-precision ephemerides. Exoplanetary architectures are derived from verified discoveries in the NASA Exoplanet Archive (IPAC/Caltech). Black hole and stellar systems are calibrated against peer-reviewed astrophysics literature (including Gillessen et al. for Sagittarius A*, Miller-Jones et al. for Cygnus X-1, and Gaia DR3 for dormant black holes).

What numerical integrators are supported, and which should I choose?

Gravity Simulator includes fourteen numerical integrators. For long-term orbital simulations spanning centuries or millennia, symplectic integrators such as PEFRL or Velocity Verlet are recommended because they conserve energy and phase space. For high-velocity close flybys, spacecraft maneuvers, or chaotic collisions, high-order Runge-Kutta integrators (like RK4 or adaptive Runge-Kutta-Fehlberg) provide maximum instantaneous trajectory accuracy.

Can I build my own solar systems or edit existing ones?

Yes! You can use the Create Scenario studio to build a system from a blank canvas, or inject new bodies into any active simulation using over 50 real-world celestial templates (stars, terrestrial worlds, gas giants, moons, and asteroids). You can also tweak physical parameters like the gravitational constant G, set a gravitational softening length, edit velocity vectors, or delete bodies on the fly.

How does Gravity Simulator handle relativistic effects and black holes?

While the underlying integration engine solves Newtonian gravity, black hole scenarios accurately scale physical masses, orbital velocities, and visual event horizon shadows to the true Schwarzschild radius and photon sphere (roughly 2.6 Schwarzschild radii). Scenarios such as Sagittarius A* model real high-velocity S-star orbits measured at relativistic perihelion speeds.

Is Gravity Simulator free, and what are the system requirements?

Gravity Simulator is 100% free and open-source under the GNU General Public License v3.0. It runs entirely inside your web browser using WebGL and Three.js with hardware-accelerated GPU graphics. There is no software to install, no plugins required, and no account signup needed.

Copyright © Darrell Arjuna Huffman 2026