Scratch to Python Converter Online: pyScratch (Test Version)


There has always been a gap between Scratch and Python. My idea is an old one: a tool that moves a child from Scratch to something harder in the friendliest way possible. That tool now exists. pyScratch is a free Scratch to Python converter online that runs in the browser, and it works in both directions.

Open pyScratch online →

The only similar approach I have seen is Minecraft Education. That’s a separate conversation.

Scratch is not a toy

A lot of people file Scratch under toys because they met it in elementary school. I disagree. Scratch is a powerful tool, and what you can build in it still impresses me. So pyScratch doesn’t say “throw away the blocks and learn something serious at last”. It takes what a child has already made in Scratch and shows it in another language.

Where kids get stuck in Python

A student who comes from Scratch already has the logic. Loops, conditions and variables make sense to them. What’s hard is that the commands have different names and you have to type them. A lot of typing. In Scratch the block you need sits in the palette and you drag it in. In Python you have to remember the name, add the brackets, the colon and the right indentation.

That’s the gap pyScratch is for: the child sees familiar blocks next to text and gets used to the text bit by bit.

Edit an .sb3 in Python: what works today

The tool is fairly simple for now, but the main path already works:

  1. In Scratch, save your project with “File → Save to your computer”. You get an .sb3 file.
  2. In pyScratch, choose “File → Open .sb3” or just drag the file onto the page.
  3. Pick a sprite or the Stage. Its scripts appear as Python-style code, and the “Scratch Blocks” tab shows the same scripts as a block tree. Clicking a block jumps to its line in the code.
  4. Change the code and press the green flag (or Ctrl+Enter). The project runs on a 480×360 stage right in the page.
  5. Save the result with “File → Save .sb3”, then open it in Scratch with “File → Load from your computer”.

It also works the other way round: write code from a blank page and pyScratch builds the Scratch blocks for you. Here is a sprite that patrols the stage and bounces off the edge (an example from the pyScratch language reference):

Python

@when_flag_clicked
def patrol():
    set_rotation_style("left-right")
    goto(0, 0)
    glide_to(0.5, "random")
    point_in_direction(90)
    for i in range(60):
        move(8)
        if_on_edge_bounce()
        wait(0.03)

Scratch

when flag clicked
set rotation style [left-right v]
go to x: (0) y: (0)
glide (0.5) secs to (random position v)
point in direction (90)
repeat (60)
  move (8) steps
  if on edge, bounce
  wait (0.03) seconds
end

Each function here is one Scratch block. The @when_flag_clicked decorator becomes the “when green flag clicked” hat block, and for i in range(60): repeats the loop body 60 times. A child who has built this out of blocks will recognise every line.

Everything runs in the browser. Your .sb3 file is not uploaded to a server, and you don’t need an account. If you don’t have a project at hand, there are nine ready-made templates, including Pong, a maze and a clicker game. pyScratch is open source: the GitHub repository is under the MIT license.

There is also an Inspector (.sb3) tab. It checks a project against Scratch’s size limits and shows which costumes and sounds weigh the most. That helps when a Scratch project won’t save because it’s too large.

In lessons, an illustration for now

So far I bring pyScratch in visually. I show a child their own script as blocks and, next to it, the same script as text. Kids like it.

I don’t have concrete stories yet. The tool is brand new.

Limits of the test version

pyScratch is in test mode, and it doesn’t match Scratch one to one yet. Here is what to know up front (the full list is in the guide below the editor):

  • It is not full Python. import, class, return, break, continue, lambda, try/except, f-strings and a few other constructs are not supported, and the compiler tells you so. This code will not run in a regular Python interpreter.
  • Scripts with blocks from non-standard third-party Scratch extensions stay in the project and are saved unchanged, but the editor shows only a comment for them. You can’t edit them as code.
  • The robotics extensions (LEGO WeDo 2.0, micro:bit, EV3, BOOST, Go Direct) need a browser with Web Bluetooth and a paired device. Without them, their blocks simply return 0 or false.
  • The stage in pyScratch is a simplified offline simulator, so small differences from Scratch are possible. The translate() block, for example, returns the text unchanged because the stage never goes online. Check the final result in Scratch.
  • Only Scratch 3.0 files (.sb3) are supported. Open an old .sb2 in Scratch 3.0 first and save it again.

Update, December 2026. pyScratch has grown a lot since this post came out. It now supports Video Sensing, Makey Makey and all five robotics extensions, keeps comments on blocks when you save, draws the fisheye and whirl effects, suggests commands as you type, and has a “New project” button. The full list is in the update history on the pyScratch page.

Who it’s for

Kids aged 9 and up, and they come in two kinds. Some are curious geeks who want to write their Scratch game in Python just because they can. Others have outgrown Scratch and need a step towards something harder.

If you’re not sure your child is ready for text code, start with Scratch vs Python for kids: how to tell when your child is ready to switch.

Try it on your own game

Take one of your own Scratch games, save it as .sb3, open it in pyScratch and see how it looks in Python. Change one number in a loop, run it, save it back and open it in Scratch.

If after that you want to write real Python, from a blank file and without blocks as hints, that’s exactly what we do in one-to-one Python lessons. And if your child is just starting with block coding, take a look at one-to-one Scratch lessons.

Sivochka Ihor avatar

Sivochka Ihor

Indie Game Developer & CS Teacher

Indie Game Developer, Wear OS enthusiast, and CS Teacher. Founder of Wrist & Pocket Studio. Passionate about retro hardware and building interactive digital experiences.