Drawing with the Pen in Scratch
A step-by-step primary lesson on the Pen blocks in Scratch: add the Pen extension, pen down and up, set pen colour and size, and draw squares and stars with loops. With a worked project and quiz.
Key takeaways
- The Pen blocks let a sprite draw a line as it moves around the stage
- 'pen down' starts drawing and 'pen up' stops; the sprite is the pen tip
- 'set pen color' and 'set pen size' change how the line looks
- Repeating a move-and-turn pair inside a loop draws shapes like squares and stars
What is the Pen in Scratch?
Imagine taping a marker to the bottom of a toy car. As the car drives around, the marker draws a line that follows its path. That is exactly what the Pen does in Scratch. Your sprite becomes the pen tip, and wherever it moves, it can leave a coloured line behind.
The Pen is one of the most fun parts of Scratch because a few simple blocks can make beautiful patterns — squares, stars, spirals and rainbows. In this lesson you will turn on the Pen, learn its main blocks, and draw real shapes step by step.
If Scratch is brand new to you, work through getting started with Scratch first. It also helps to understand how the sprite moves around the grid, which you can learn in coordinates and movement in Scratch.
Step 1: Turn on the Pen blocks
The Pen blocks are hidden until you switch them on.
- Look at the bottom-left corner of the Scratch screen for the Add Extension button (it looks like a small square with a plus).
- Click it, then choose Pen from the list.
A new blue Pen category now appears in your blocks palette. These are the blocks we will use:
- pen down — lowers the pen so the sprite starts drawing.
- pen up — lifts the pen so the sprite can move without drawing.
- erase all — clears every pen mark from the stage.
- set pen color to — picks the colour of the line.
- set pen size to — sets how thick the line is.
- stamp — prints a copy of the sprite's costume onto the stage.
Step 2: Draw your first line
Let's draw a single straight line. Click a sprite (the cat is fine) and build this script:
when green flag clicked
erase all
go to x: -150 y: 0
pen down
move 200 steps
pen up
Read it block by block:
- erase all clears anything left from before.
- go to x: -150 y: 0 moves the sprite to the left side of the stage before drawing, so the line starts there.
- pen down presses the pen onto the stage.
- move 200 steps slides the sprite to the right, dragging a line behind it.
- pen up lifts the pen so the sprite stops drawing.
Click the green flag and you will see a straight line appear. That is your first drawing!
Step 3: Choose a colour and thickness
A plain line is a bit boring. Let's make it bold and colourful. Add two blocks right after erase all:
when green flag clicked
erase all
set pen color to [blue]
set pen size to 8
go to x: -150 y: 0
pen down
move 200 steps
pen up
- set pen color to lets you click the colour swatch and slide the colour, brightness and shade to pick any colour you like.
- set pen size to 8 makes the line 8 pixels thick. Try changing 8 to 2 for a thin line, or 20 for a chunky one.
Step 4: Draw a square with a loop
Drawing one line is easy, but drawing four lines one at a time would be slow. A square is just the same action repeated: move forward, then turn a corner. In Scratch we use a repeat loop so we do not have to copy blocks over and over. If loops are new to you, see loops and repeats.
A square has 4 sides and 4 corners. Each corner is a 90-degree turn. So we repeat "move, turn 90" four times:
when green flag clicked
erase all
set pen color to [purple]
set pen size to 5
go to x: 0 y: 0
pen down
repeat 4
move 100 steps
turn right 90 degrees
pen up
Click the green flag. The sprite walks forward 100 steps, turns right, walks again, turns again — four times — and ends up back where it started, having drawn a perfect square. Magic!
A worked project: a colourful star
Now let's draw something prettier — a five-pointed star. The trick to a star is the turn angle. To draw a star you make 5 points, and at each point the sprite turns by 144 degrees (because 5 points × 144 = 720, which is two full circles, the special pattern that makes a star).
Add the Pen extension if you have not already, then build this on your sprite:
when green flag clicked
erase all
set pen color to [yellow]
set pen size to 4
go to x: 0 y: -50
pen down
repeat 5
move 150 steps
turn right 144 degrees
pen up
Here is what happens, step by step:
- erase all gives a clean stage, and the pen colour and size are set to a thick yellow.
- The sprite moves to a starting spot near the bottom and pen down begins drawing.
- The repeat 5 loop runs the move-and-turn pair five times. Each
turn right 144 degreessends the line across to the opposite point of the star. - After 5 lines the star joins up, and pen up stops drawing.
Click the green flag and watch a star appear in five quick strokes. Try changing the colour or the move 150 steps to draw a bigger or smaller star.
Try it: make it your own
You can draw lines, squares and stars. Now experiment with these challenges:
- Change the shape: for a triangle, use
repeat 3andturn right 120 degrees. For a hexagon, userepeat 6andturn right 60 degrees. - Rainbow shapes: put your shape inside another
repeat 6loop, and addchange pen color by 20andturn right 60 degreeseach time, to spin colourful copies into a flower pattern. - Make a spiral: in a loop,
move 5 steps, thenturn right 15 degrees, and slowly grow the move amount. - Stamp art: use
pen upand thestampblock to print rows of your sprite instead of lines.
If a shape does not close up neatly, check your turn angle and your repeat number — for any regular shape, the angle is 360 divided by the number of sides. Reading your blocks carefully to find the problem is called debugging, and every coder does it. Have fun drawing! ✏️
Quick quiz
Test yourself and earn XP
What does the 'pen down' block do?
'pen down' lowers the pen so the sprite draws a line wherever it goes, like pressing a pen onto paper.
How do you stop the sprite from drawing?
'pen up' lifts the pen so the sprite can move without leaving a line.
To draw a square, how many times do you repeat 'move 100 steps, turn 90 degrees'?
A square has 4 equal sides and 4 right-angle corners, so you repeat the move-and-turn pair 4 times.
Why do we usually add 'erase all' at the start of a drawing script?
'erase all' wipes every pen mark, so your new drawing does not pile on top of the last one.
Which block makes the drawn line thicker?
Pen size controls the thickness of the line, so a bigger size value draws a fatter line.
FAQ
They are not shown by default. Click the 'Add Extension' button at the bottom-left of the screen, then choose 'Pen'. A new blue Pen category appears in the blocks palette with all the drawing blocks.
Add an 'erase all' block right after 'when green flag clicked'. That clears every pen mark before you draw again, so each run starts on a clean stage.
Keep exploring
More in Coding