What you enter stays on your device while you use this tool. Opening a shared link sends the settings in its address to HowToolbox to prepare the page.
Gravity sandbox
Key values as a table
| Body | Mass | Position | Speed |
|---|---|---|---|
| 1 | 1 | 0, 0 | 0 |
| 2 | 0.001 | 1, 0 | 1 |
| 3 | 0.0005 | −1.06, 1.45 | 0.75 |
Drag a dot on the picture to aim: the dashed line shows the path, and letting go throws the body.
- Bodies
- 3 of 12
- Total energy
- −0.00064
- Energy change since the start
- 0%
Total energy −0.00064 (units where the Sun has mass 1 and a circular orbit of radius 1 takes 2π). Drag a dot to aim: letting go throws a new body.
A sun and two planets are already orbiting. Aim a new planet, throw it in and watch slingshots, binary stars and collisions happen.
Pause, step and speed controls on the picture, zoom to follow bodies that fly away, and a predicted path while you aim.
How to use
- Watch the sun and its two planets orbit. Pick another system from the list, such as the figure-eight, a slingshot or a head-on collision.
- Drag the launch dot to choose where a new planet starts, and the dot at the end of the dashed arrow to choose how fast and which way it goes. While you hold a dot, a dashed line shows the path it would take; let go to throw it. With the keyboard, focus a dot and use the arrow keys.
- Or press Throw the new body, after setting its place, speed and mass in the Next body tab. Pause, step, change the speed or zoom out with the controls on the picture; an arrow at the edge points to any body that flew out of view.
How it works
Every body pulls on every other body. The pull is stronger for heavier bodies and weaker the farther apart they are. A body that moves sideways fast enough keeps missing the thing it falls towards, and that is an orbit. A little faster and the orbit stretches out, much faster and the body escapes.
Newton's law gives the pull between two masses as F = G·m₁·m₂ ÷ r². Here the units are chosen so that G = 1 and the Sun has mass 1. A planet in a circular orbit at distance r then moves at v = √(1 ÷ r), so at r = 1 the speed is 1 and one orbit takes 2π, about 6.28 time units. The page steps all the bodies forward together with the leapfrog method, which keeps the total energy nearly steady for a long time. The drift shown should stay close to zero. Touching bodies merge into one that keeps their total mass and momentum.
A gravity slingshot happens when a small body passes close to a moving planet: it steals a little of the planet's motion and leaves faster. The figure-eight is a rare solution for three equal masses found numerically by Cris Moore in 1993 and proved by Chenciner and Montgomery in 2000. Three bodies are otherwise chaotic, so a small change in the throw can end in a very different story.
Method
No outside data is used: the result is worked out directly from the formula F = G m₁ m₂ / r², explained under How it works.
Frequently asked questions
Why do planets orbit instead of falling into the sun?
They are falling all the time, but they also move sideways fast. Their sideways speed makes them miss the sun again and again, so they curve around it.
How fast do I need to throw for a circular orbit?
At distance r from a sun of mass 1 the speed is the square root of 1 divided by r. At distance 2.2 that is about 0.67, the default.
What is a gravity slingshot?
A small spacecraft passes behind a moving planet and gains speed from its motion. Real probes such as Voyager used it. Try the slingshot system and watch the small probe fly out.
Why does the figure-eight stay stable?
Three equal masses on the right starting positions and speeds chase each other along one figure eight. It is a precise balance, and a small push breaks it.
Is this an exact simulation?
It is a close one. The leapfrog method conserves energy well, but very close passes between bodies are softened to avoid infinite forces, and chaotic systems amplify tiny errors.
Next you might need
More in Physics
- Coulomb's law calculator, private, runs on your device
- Decibel calculator, private, runs on your device
- Doppler effect calculator, private, runs on your device
- Double pendulum, private, runs on your device
- Double-slit experiment, private, runs on your device
- E = mc² calculator, private, runs on your device





