How gravity creates orbits
Gravity is an attractive force between any two masses. Isaac Newton showed in 1687 that the force decreases with the square of the distance: double the distance and the force drops to one quarter. Albert Einstein later reframed gravity not as a force but as the curvature of spacetime — massive objects bend the fabric of space and time, and other objects follow those curves. For everyday orbital mechanics (planets, satellites, moons), Newton's equations give answers accurate to better than a millimetre per year.
An orbit occurs when a body moves sideways fast enough that as gravity pulls it toward the central mass, it keeps missing it. At exactly the right speed for a given altitude, the inward pull of gravity and the body's tendency to travel in a straight line balance perfectly — producing a stable orbit. Too slow and the object spirals inward; too fast and it escapes. For more on the underlying physics of gravity, see our how gravity works guide.
Kepler's three laws describe orbital shapes and speeds mathematically: orbits are ellipses; a line from planet to Sun sweeps equal areas in equal times (so planets move faster when closer); and the orbital period squared is proportional to the semi-major axis cubed. These laws apply to every orbiting system — moons, satellites, comets, binary stars.