Spirograph

Draw spirograph curves with ring, wheel and pen settings, then save a PNG.

About this tool

Set the ring radius R, the wheel radius r and the pen's distance d from the wheel's centre, plus the line width, drawing speed and colours. Press Draw to watch the curve trace itself, or Draw instantly. Tick Outside to roll the wheel around the outside of the ring. Layer several curves in different colours, press Random for surprises, and save the result as a PNG.

The maths behind the spirograph

A spirograph traces the path of a pen held in a toothed wheel as it rolls around inside a fixed ring. The curve is a hypotrochoid. With ring radius R, wheel radius r and pen distance d, the pen's position at angle t is x = (R βˆ’ r)cos t + dΒ·cos((R βˆ’ r)t / r) and y = (R βˆ’ r)sin t βˆ’ dΒ·sin((R βˆ’ r)t / r). When the wheel rolls around the outside, the curve becomes an epitrochoid. The pattern closes after the wheel's centre has travelled round r Γ· gcd(R, r) times, and it has R Γ· gcd(R, r) loops, where gcd is the greatest common divisor. That is why numbers with no common factor make the richest designs. R = 96 and r = 35 share no factor, so the curve has 96 loops and closes only after the wheel has gone round 35 times. R = 96 and r = 32 share 32, giving just 3 loops. The pen distance changes the character. When d is smaller than r the curve stays smooth, and when it is larger the pen swings outside the wheel and makes loops. The kaleidoscope drawing tool makes symmetric freehand art, the graphing calculator draws other functions and the GCD calculator finds common factors.

Frequently asked questions

How does a spirograph work?

A pen in a toothed wheel traces a curve as the wheel rolls around inside (or outside) a fixed ring. The shape depends on the two radii and the pen's position.

How many loops will my spirograph have?

R Γ· gcd(R, r), where R is the ring radius and r the wheel radius. 96 and 35 give 96 loops; 96 and 32 give 3.

Can I save the drawing?

Yes. The PNG button downloads the canvas as an image.

Is anything uploaded?

No. Drawing happens in your browser and nothing is stored or sent.