🐢 Turtle Draw: Code a Drawing
Tap blocks or type commands to steer the turtle · 12 drawing challenges and free draw · Save your picture · Grades 2–8
Challenge 1
Change the numbers by typing. Press Ctrl+Enter (or Command+Enter) to draw from the keyboard.
Command cheat sheet
- forward 50 (or fd 50): move and draw
- back 50 (or bk 50): move backward
- right 90 / left 90 (rt, lt): turn on the spot, in degrees
- repeat 4 [ ... ]: do the commands in the brackets 4 times
- repcount: 1, 2, 3... counts the times round a repeat
- pen up / pen down: stop or start drawing
- pen color blue: black, red, orange, yellow, green, blue, purple, pink, brown, gray, teal, white
- pen size 6: line thickness from 1 to 30
- home: go back to the start
How Turtle Draw Works
The turtle holds a pen. When it moves forward, it draws a line behind it. Your program tells it how far to go and how far to turn. Turns are in degrees: right 90 is a square corner, and four of those make a full turn of 360 degrees.
Tap a block to add that command as a new line, then change the number by typing. You can also type everything yourself. Put one command on each line, or several on one line with spaces between them. Capital letters do not matter.
Making shapes with repeat
Many shapes are one small pattern done again and again. A square is “forward 100, right 90” four times, so repeat 4 [ forward 100 right 90 ] draws it in one line. For any shape with equal sides, the turns add up to 360 degrees. That is why a triangle turns 120 (360 ÷ 3) and a hexagon turns 60 (360 ÷ 6). The star turns 144 five times, which adds up to 720: two full turns, which is why its lines cross.
Growing lines with repcount
Inside a repeat, the word repcount means “which time round is this?” It is 1 the first time, 2 the second time, and so on. forward repcount * 8 draws a line of 8, then 16, then 24, which is how the spiral challenge grows. You can use + − * / and brackets with numbers.
When something goes wrong
If the turtle does not understand a line, it tells you the line number and what it expected, and highlights that line. It also suggests a fix for small spelling slips, such as “forwrd”. In a challenge, the page checks your lines against the blue outline. If a line is too long or turns the wrong way, it tells you whether part of the outline is missing or a line goes outside it.
For Parents and Teachers
Turtle graphics give instant visual feedback for every number a student changes, so they are a good bridge from block coding to typed code. The challenges move from single commands to loops, pen up and pen down, nested shapes and a counter variable.
- Predict first. Before pressing Draw, ask students to sketch on paper what they think the turtle will draw.
- Act it out. Have a student walk the square on the floor: step forward, turn right a quarter turn, four times. Then try the triangle and ask why 90 does not work.
- Math links. The exterior angle pattern (360 ÷ number of sides) comes up in the triangle, hexagon and circle challenges. The spiral uses a growing pattern (8, 16, 24...).
- Free draw and share. Students can save their drawing with Download PNG and paste the program into a class document so others can run it.
Completion code
Finishing a challenge shows a completion code with the number of challenges finished on that device out of 12 (activity ID CTD). Check codes on the Score Checker. Progress is stored only in the browser on that device. Nothing is sent anywhere, and the downloaded picture is made in the browser.
Standards
Turtle Draw supports these CSTA K–12 Computer Science Standards (2017):
- 1A-AP-10: “Develop programs with sequences and simple loops, to express ideas or address a problem.” (Challenges 1–7, free draw)
- 1B-AP-09: “Create programs that use variables to store and modify data.” (Challenge 12 uses the repcount counter.)
- 1B-AP-15: “Test and debug (identify and fix errors) a program or algorithm to ensure it runs as intended.” (Error messages and outline checks)
- 2-AP-12: “Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.” (Nested repeats in free draw)
Sources
- Computer Science Teachers Association: CSTA K–12 Computer Science Standards (2017) progression chart
FAQ
Which commands does the turtle know?
forward, back, right, left, repeat with square brackets, pen up, pen down, pen color with a color name, pen size and home. Short forms fd, bk, rt, lt, pu and pd work too. Inside a repeat, repcount counts 1, 2, 3 as the loop goes round.
Why does my challenge say lines go outside the outline?
The checker compares your lines with the blue outline, allowing a few steps of wobble. A line that is too long, a turn the wrong way or a turn that is too big puts lines outside it. Draw at Slow speed and watch where the turtle first leaves the outline.
Can I save my drawing?
Yes. Press Download PNG to save the picture to your device. The blue outline and the turtle are not included, just your lines on a cream background. On a tablet, the browser may ask before it saves the file.
Does the page keep my programs?
Your program for each challenge stays while the page is open. Which challenges you have finished is saved in this browser on this device only. Nothing is sent anywhere.
Keep Exploring
- Robot Maze: block coding puzzles with loops, if-checks and bug hunts.
- Sorting Algorithms: race bubble, selection and insertion sort on the same cards.
- Pixel Art: draw on a grid of squares like a computer screen.
- HTML Basics: type real web page code and see it change.
- Unplugged Coding: coding games with no screen.
- Beat Maker: make a looping drum beat.
- Coding and Computers: all the coding games and lessons.
Last reviewed: November 2026