Kepler's laws, in this lab, are three things you can watch at once: a planet on an ellipse with the star at one focus, a star-to-planet line that sweeps equal areas in equal times, and a period fixed by T² = 4π²a³/(GM). Reshape the orbit with the sliders, change the star's mass, or load a planet from JPL's orbital elements. The panel then prints the period, the closest and farthest distances and the speed at each end.
A planet on an adjustable ellipse round a star, timed by Kepler's equation. The orbit is cut into sectors that each take the same time to sweep, and every sector has the same area (second law). The star sits at one focus of the ellipse (first law), and the period depends only on the semi-major axis and the star's mass: T2 = 4π2a3/(GM) (third law). The log–log chart puts the eight planets and your orbit on one straight line of slope 1.5.
The four planet presets press the lab's own JPL buttons, which load that planet's semi-major axis and eccentricity exactly and set the star to one solar mass. The other three write the sliders directly. The line underneath is copied from the panel once it has updated, so it can only repeat what the lab is showing.
Pick an orbit above, or drag the sliders yourself.

The Kepler's laws simulator is a free interactive physics lab that runs in your browser — nothing to install and no sign-up. Set a semi-major axis from 0.1 to 40 AU, an eccentricity from 0 to 0.975 and a star of 0.1 to 10 solar masses, or load any of the eight planets from JPL's orbital elements. A planet then goes round the ellipse in real time, cut into equal-time sectors of equal area, while the panel prints the period, both end distances and both end speeds, and a log–log chart places your orbit among the planets.
| Control | Range | Step |
|---|---|---|
| Semi-major axis | 0.1 – 40 AU | 0.01 |
| Eccentricity | 0 – 0.975 | 0.001 |
| Star mass | 0.1 – 10 solar masses | 0.1 |
| Equal-time sectors | 2 – 24 | 1 |
| Animation speed | 0.25× – 4× | 0.25 |
| Planet buttons | 8 planets (JPL) | buttons |
Start from a 1 AU circle round one solar mass and move a single slider per row; rows 4 and 5 go back to that circle and change one thing there. Every cell below is a string the running lab printed at that setting, so if a cell and your screen ever disagree, believe the screen. The algebra behind each row, and why stretching the ellipse never moves the period, is set out in Kepler's laws of planetary motion.
| Step | Sliders: axis, eccentricity, star | Orbital period | Third-law ratio | Perihelion | Aphelion | Speed at perihelion | Speed at aphelion | Speed ratio |
|---|---|---|---|---|---|---|---|---|
| Start: a 1 AU circle | 1.000 AU · 0.0000 · 1.0 solar masses | 1.000 years = 365.3 days |
1.000 yr2/AU3 | 1.000 AU | 1.000 AU | 29.78 km/s | 29.78 km/s | 1.000 |
| Eccentricity to 0.5 | 1.000 AU · 0.5000 · 1.0 solar masses | 1.000 years = 365.3 days |
1.000 yr2/AU3 | 0.5000 AU | 1.500 AU | 51.59 km/s | 17.20 km/s | 3.000 |
| Eccentricity to 0.9 | 1.000 AU · 0.9000 · 1.0 solar masses | 1.000 years = 365.3 days |
1.000 yr2/AU3 | 0.1000 AU | 1.900 AU | 129.8 km/s | 6.833 km/s | 19.00 |
| From row 1, semi-major axis to 4 AU | 4.000 AU · 0.0000 · 1.0 solar masses | 8.000 years = 2,922 days |
1.000 yr2/AU3 | 4.000 AU | 4.000 AU | 14.89 km/s | 14.89 km/s | 1.000 |
| From row 1, star mass to 2 | 1.000 AU · 0.0000 · 2.0 solar masses | 0.7071 years = 258.3 days |
0.5000 yr2/AU3 | 1.000 AU | 1.000 AU | 42.12 km/s | 42.12 km/s | 1.000 |
Rows 1 to 3 move only the eccentricity, and the period column never leaves 1.000 years. Everything else does move: the closest approach shrinks from 1.000 AU to 0.1000 AU, the far end stretches to 1.900 AU, and the planet rushes past the star at 129.8 km/s but creeps round the far end at 6.833 km/s. Eccentricity shapes the orbit and sets the speeds, but it has no say in how long a lap takes.
Row 4 takes the row 1 circle and makes it four times wider. The period becomes 8.000 years, eight times longer, because 8 squared and 4 cubed are both 64, and the speed halves from 29.78 km/s to 14.89 km/s. The third-law ratio does not budge from 1.000, which is the third law doing its job.
Row 5 keeps the row 1 circle and doubles the star's mass instead. The canvas draws the same circle and both distance columns still read 1.000 AU, yet the period drops to 0.7071 years and the speed rises to 42.12 km/s. The shape is set by a and e; the heavier star only makes the planet go round it faster, and the ratio falls to 0.5000, one over the star's mass.
Only two sliders ever touch the period. Across the five rows the period changed in rows 4 and 5 alone, where the semi-major axis or the star's mass moved. The panel's tip line makes the same promise, and you can test it on a real planet: press Earth, drag the eccentricity to 0.5000 and the period still reads 1.000 years, although the orbit now swings between 0.5000 AU and 1.500 AU.
The period comes from T = 2π·sqrt(a³/(GM)), the two ends of the orbit from q = a(1 − e) and Q = a(1 + e), and every speed from the vis-viva equation v = sqrt(GM(2/r − 1/a)). The planet's position at each moment comes from Kepler's equation, E − e·sin E = 2πt/T, solved afresh on every frame. Ranges marked “in this lab” are the simulator's own readouts at the slider ends.
| Symbol | Meaning | SI unit | In this lab |
|---|---|---|---|
| a | Semi-major axis: half the longest diameter of the ellipse, and the average of the perihelion and aphelion distances | metre, m (shown in astronomical units, AU) | 0.1 to 40 AU in this lab, in steps of 0.01; 1 after Reset. The planet buttons load JPL's exact value, from 0.3871 AU for Mercury to 30.07 AU for Neptune. |
| e | Eccentricity: the star's distance from the centre of the ellipse as a fraction of a | none | 0 to 0.975 in this lab, in steps of 0.001; 0.5 after Reset. The label prints four decimal places, 0.0167 for Earth. |
| M | Mass of the star at the focus, in multiples of the Sun's | kilogram, kg (shown in solar masses) | 0.1 to 10 solar masses in this lab, in steps of 0.1; 1 after Reset and after every planet button. |
| T | Orbital period, one full lap | second, s (shown in years and days) | From 0.01000 years (3.653 days) at a = 0.1 AU round 10 solar masses up to 800.0 years (292,206 days) at 40 AU round 0.1 solar masses. |
| T2/a3 | Third-law ratio, the same for every orbit round one star | s2/m3 (shown in yr2/AU3) | 1.000 for any orbit round 1 solar mass; 0.1000 at 10 solar masses and 10.00 at 0.1. |
| q, Q | Perihelion and aphelion distances, q = a(1 − e) and Q = a(1 + e) | metre, m (shown in AU) | q can fall to 0.002500 AU (a = 0.1 AU, e = 0.975) and Q can reach 79.00 AU (a = 40 AU, e = 0.975). |
| b, c | Semi-minor axis, b = a·sqrt(1 − e2), and the star's distance from the centre, c = ae | metre, m (shown in AU) | For a circle b equals a and c reads 0.000 AU; after Reset they read 0.8660 AU and 0.5000 AU. |
| vp, va | Speeds at perihelion and at aphelion, from the vis-viva equation | metre per second, m/s (shown in km/s) | From 0.1676 km/s at aphelion (a = 40 AU, e = 0.975, 0.1 solar masses) to 2647 km/s at perihelion (a = 0.1 AU, e = 0.975, 10 solar masses). |
| vp/va | Speed ratio, equal to Q/q = (1 + e)/(1 − e) | none | 1.000 for any circle up to 79.00 at e = 0.975. |
| n | Number of equal-time sectors the orbit is cut into | none (a count) | 2 to 24 in this lab, in steps of 1; 8 after Reset. |
| πab/n | Area of each sector, the ellipse's area shared equally | square metre, m2 (shown in AU2) | 0.3401 AU2 each, swept in 45.66 days, for the 8 sectors after Reset; 1.360 AU2 and 182.6 days with 2 sectors. |
| πab/T | Areal rate: area swept by the star-to-planet line per unit time | m2/s (shown in AU2 per year) | 2.721 AU2 per year after Reset; 3.142 for a 1 AU circle round 1 solar mass. |
| r, v | Live distance from the star and live speed | m and m/s (shown in AU and km/s) | Always between q and Q, and between va and vp: 0.8479 AU and 34.72 km/s at 0.125 T after perihelion on the Reset orbit. |
| ν | True anomaly: the angle at the star from perihelion to the planet | radian (shown in degrees) | 0.0° at perihelion and 180.0° at aphelion, to one decimal place; the phase line gives the time since perihelion as a fraction of T to three decimals. |
| GM | The Sun's gravitational parameter, multiplied by the star-mass slider | m3/s2 | Fixed at 1.3271244 × 1020 m3/s2 (IAU 2015 nominal), with 1 AU = 149,597,870,700 m and 1 year = 365.25 days, as the constants line prints. |
The first law is drawn literally: the gold star sits at the right-hand focus of the ellipse and a small cross marks the other, empty one. The note line says so in words, The star sits at one focus; the other focus is empty. Take the eccentricity to 0 and the cross vanishes into the star, Star to centre c reads 0.000 AU and the note changes to the circle message. So the slider's zero end still obeys the first law: the lab simply draws its two foci on top of each other.
The second law is in the shading. The boundaries between wedges are placed at equal steps of time, yet every wedge encloses the same area, which the lab prints. The reason is angular momentum: gravity pulls straight along the star-to-planet line, so it can never twist the planet's motion round the star, and the area swept each second stays fixed. That fixed rate is the Areal rate readout.
The speeds come from energy. As the planet falls inwards it trades gravitational potential energy for kinetic energy, so its fastest point is its closest: the live Speed v peaks each time the phase line reads 0.000 T after perihelion. At perihelion and aphelion the planet moves square-on to the star line, which is why the ratio row is labelled = aphelion / perihelion distance.
The third law loses its constants in the lab's units. With T in years, a in AU and M in solar masses it reads T2 = a3/M, so the ratio readout is 1.000 for every orbit round one solar mass and 1/M for any other star. On the chart the gold line is that law drawn on logarithmic axes, where a period growing as a1.5 rises with a slope of exactly 1.5.
Kepler found these rules in observations of the planets; Newton later showed that one inverse-square force, combined with his laws of motion, produces all three, as our guide to the law of gravitation explains. The lab uses Newton's form directly: it takes the Sun's GM from its constants line and multiplies it by the star-mass slider. That same pull, with both masses on sliders and the force falling as one over the square of the separation, is what the universal gravitation simulator draws.
The lab solves the two-body problem exactly, so the laws hold perfectly on screen. Real orbits depart from them in the ways below, and each item says what the lab does about it.
The full explanation, with a scale drawing of the ellipse, JPL's figures for all eight planets and seven solved problems, is in the article Kepler's Laws of Planetary Motion. To put your own numbers through the third law, including moons and satellites, use the Kepler's third law calculator. The force behind every orbit here is the subject of the universal gravitation simulator, and the rest of our tools are in the library of physics simulations.
It shows all three of Kepler's laws on one screen. A planet moves round an ellipse with the star at one focus, the orbit is shaded into sectors that each take the same time and hold the same area, and the panel prints the period, the closest and farthest distances and the speed at each end. A log-log chart under the orbit places your setting among the eight planets.
Because the period depends only on the semi-major axis and the star's mass, and the eccentricity is neither. Take a 1 AU orbit round one solar mass from 0 to 0.9 and the period holds at 1.000 years, while the perihelion falls to 0.1000 AU and the speed there climbs from 29.78 km/s to 129.8 km/s. The faster dash past the star exactly pays for the slower crawl far out.
Because the animation is scaled so that one orbit always lasts 10 seconds at 1x, whatever its real period. Without that, Neptune would appear frozen next to Mercury. The Animation speed slider changes only this screen time, from one orbit per 40 s at 0.25x to one per 2.5 s at 4x. The real period is the number on the panel, never the animation.
Because the lab works out each period from the third law itself, with the planet's own mass ignored, so T²/a³ is 1.000 yr²/AU³ by construction round one solar mass. The planet dots on the chart use JPL's measured periods instead, and every one lies within 0.1 % of the formula; for Jupiter, the heaviest planet, the gap is about 0.05 %. The two are far too close to separate on the chart.
Each shaded wedge is the area the star-to-planet line sweeps in the same length of time, and every wedge has the same area. The Second law: equal areas block in the panel prints that shared area and how long each wedge takes, 0.3401 AU² each and 45.66 days for the orbit you get after Reset. Wedges near perihelion come out short and wide, wedges near aphelion long and thin.
Because any eccentricity below 1 is still a closed ellipse, and 0.975 is enough for very stretched, comet-like orbits. At 1 or more the path becomes a parabola or hyperbola, the body escapes and there is no period to show, so the lab does not model it. At 0.975 on a 1 AU orbit the perihelion is 0.02500 AU and the speed ratio reaches 79.00.
Only for the shape of the argument, not for the numbers, because the star-mass slider starts at 0.1 solar masses, far heavier than any planet. The same laws hold round Earth or Jupiter, with that body's mass in place of the star's. For a satellite or a moon, use the Kepler's third law calculator linked on this page, which accepts Earth masses and kilometres.
Because JPL's table of planetary elements lists Earth and the Moon together as one point, their shared centre of mass, and the constants line under the sim names that row as the one the Earth button loads. It is the path Earth's orbit is usually quoted for. The button gives a period of 1.000 years, a perihelion of 0.9833 AU and an aphelion of 1.017 AU.