Logo Turtle Drawing

Type FD 100, RT 90 and watch the turtle draw — exactly like MSW Logo in the computer lab, but right here in the browser. REPEAT loops, your own TO commands, and a shape challenge to beat.

Class 3–7 30+ Logo commands Step-by-step animation 11 challenges

In Logo, FD 100 moves the turtle 100 steps forward and RT 90 turns it 90° to the right, so REPEAT 4 [ FD 100 RT 90 ] draws a complete square. The outside turn for any regular shape is 360 ÷ number of sides, so a triangle needs RT 120, a pentagon RT 72 and a hexagon RT 60.

Your program

One or many commands per line. ; starts a comment.

Ctrl+Enter runs

Tap a command

For hands that are still learning to type.

Move

Turn

Pen & screen

Loops & blocks

Pen colour

Pen size

x 0 y 0 heading 0° pen down step 0 / 0

Tap any picture to load it, then press Run to watch the turtle draw it step by step.

How it works

Four words and you can draw anything

Logo gives a small robot turtle four simple orders: go forward, go back, turn right, turn left. Everything else — squares, stars, rangoli patterns — is built from those four.

Type a command

FD 100 walks the turtle 100 steps forward, leaving a line behind it.

Turn the turtle

RT 90 turns it a quarter turn to the right. LT 90 turns left.

Press Run

Watch each step happen. Use Step to move one command at a time, or slow the speed down.

Shorten it with REPEAT

REPEAT 4 [ FD 100 RT 90 ] draws a whole square in one line.

The turn rule for any shape

Outside turn = 360 ÷ number of sides

A square has 4 sides, so the turn is 360 ÷ 4 = 90°. A triangle: 360 ÷ 3 = 120°. A pentagon: 72°. A hexagon: 60°. The turtle comes back to the start because all the turns add up to one full circle of 360°.

REPEAT — the loop

REPEAT n [ commands ]

Everything inside the square brackets happens n times. Loops can sit inside loops: REPEAT 6 [ REPEAT 4 [ FD 50 RT 90 ] RT 60 ] draws one square, turns 60°, and does it six times — a flower.

REPCOUNT gives the loop number (1, 2, 3 …), which is how spirals are made.

Teach the turtle a new word

TO SQUARE :SIDE … END

A procedure gives a group of commands a name. Afterwards SQUARE 80 draws a square of side 80, and SQUARE 200 a bigger one. The :SIDE part is the input — this is exactly how real programs reuse code.

Directions and coordinates

Heading 0° is north (up), 90° east, 180° south, 270° west — clockwise, like a compass. The turtle starts at the centre, x = 0, y = 0.

HOME brings it back to the middle, SETXY 100 -50 sends it to a point, PU lifts the pen so it moves without drawing, and CS clears the screen.

For the computer lab: the commands here are the same ones in the MSW Logo chapters of most Class 3–7 computer textbooks, so practice at home carries straight over to the school lab.
Questions & answers

Logo Turtle Drawing — your questions

What do FD, BK, RT and LT mean in Logo?

FD (FORWARD) moves the turtle forward by the number of steps you give, BK (BACK) moves it backwards, RT (RIGHT) turns it clockwise by that many degrees and LT (LEFT) turns it anticlockwise. Each needs a number after it, as in FD 100 or RT 90. Logo ignores capital letters, so fd 100 works too.

How do I draw a square in Logo?

The long way is FD 100 RT 90 FD 100 RT 90 FD 100 RT 90 FD 100 RT 90. The short way uses a loop: REPEAT 4 [ FD 100 RT 90 ]. Everything inside the square brackets happens four times. Change 100 to make the square bigger or smaller.

How do I work out the turn for a triangle or a hexagon?

Outside turn = 360 ÷ number of sides. A triangle has 3 sides, so the turn is 120°: REPEAT 3 [ FD 100 RT 120 ]. A pentagon needs 72°, a hexagon 60° and an octagon 45°. The turtle finishes where it started because all the turns add up to one full circle of 360°.

What does the REPEAT command do in Logo?

REPEAT n [ commands ] runs everything inside the square brackets n times. Loops can sit inside loops, so REPEAT 6 [ REPEAT 4 [ FD 50 RT 90 ] RT 60 ] draws a square, turns 60° and does it six times to make a flower. REPCOUNT gives the loop number, which is how spirals are drawn.

How do I teach the turtle a new command?

Use a procedure: TO SQUARE :SIDE REPEAT 4 [ FD :SIDE RT 90 ] END. After that, typing SQUARE 80 draws a square of side 80 and SQUARE 200 draws a bigger one. The :SIDE part is the input. This is exactly how real programs reuse code instead of repeating it.

What do PU, PD, HOME and CS do?

PU (PENUP) lifts the pen so the turtle moves without drawing, and PD (PENDOWN) puts it back. HOME sends the turtle to the centre facing north, and CS (CLEARSCREEN) wipes the drawing and sends it home. SETXY 100 -50 moves the turtle straight to a point.

Is this the same as MSW Logo used in school?

The commands are the same ones taught in the MSW Logo chapters of most Class 3 to 7 computer textbooks — FD, BK, RT, LT, PU, PD, CS, REPEAT and TO procedures — so practice at home carries straight over to the school lab. The difference is that this page runs in a browser, with nothing to install.