Ready. Press Run or Save .sb3. Ln 1, Col 1

Scratch to Python converter online: what pyScratch does

pyScratch is a free online IDE that opens Scratch 3.0 projects (.sb3) and shows every script as Python-style code. You can edit an .sb3 in Python, run it on a 480×360 stage right in the page and save it back as an .sb3 file that opens in the regular Scratch editor. It also works the other way round: write Python-like code from scratch and pyScratch builds the Scratch blocks for you. It is made for students moving from Scratch to Python and for teachers who want to show the same program as blocks and as text.

How to open an .sb3 online and convert it to Python

  1. In the Scratch editor, choose “File → Save to your computer” to get the .sb3 file of your project.
  2. In pyScratch, choose “File → Open .sb3”, or simply drag the .sb3 file onto the page.
  3. Pick a sprite or the Stage in the panel under the stage. The code editor shows its scripts as Python, and the “Scratch Blocks” tab shows the same scripts as a block tree; clicking a block jumps to its line of code.
  4. Edit the code and press the green flag (or Ctrl+Enter) to run the project on the stage.
  5. Choose “File → Save .sb3”, then load the downloaded file in Scratch with “File → Load from your computer”.

The “Inspector (.sb3)” tab checks the project against Scratch’s limits (5 MB for project.json and 10 MB per asset) and helps you remove unused costumes and sounds. If Scratch says “Project could not save”, here is what to do when a Scratch project won’t save.

What the Python code can do

The code is a small Python dialect where each function maps to a Scratch block: move(10), say("Hello!", 2), if touching("edge"):, for i in range(10):, while True: and so on. Decorators such as @when_flag_clicked or @when_key_pressed("space") become event hats, def creates a My Blocks definition (@warp runs it without screen refresh), score = 0 is a variable for all sprites and self.hp = 100 is a variable for this sprite only.

Supported categories are Motion, Looks, Sound, Events, Control, Sensing, Operators, Variables and lists, My Blocks and clones, plus the Pen, Music, Text to Speech, Translate, Video Sensing and Makey Makey extensions. The “API Reference” tab lists every command, and nine learning templates (Pong, a maze, a clicker game and more) give you ready-made examples.

Honest limits

Update history & roadmap

Already shipped

Planned next

Privacy: your project stays in the browser

pyScratch runs entirely in your browser. The .sb3 file is unpacked and packed on your device, nothing is uploaded to a server, and there is no account or sign-up. The page only counts anonymous visits without cookies. The “Share” button puts your code into the link itself, so anyone who gets the link can see that code.

Frequently asked questions

Can I convert a Scratch project to Python online for free?

Yes. Open the .sb3 file in pyScratch and the scripts of every sprite appear as Python-style code. The tool is free, needs no installation or account, and is open source under the MIT license.

How do I open an .sb3 file online without installing Scratch?

Choose “File → Open .sb3” or drag the file onto the page. You can read the scripts as code and as blocks, run the project on the stage and look through its assets without installing anything.

Can I edit an .sb3 in Python and open it in Scratch again?

Yes. Change the code, choose “File → Save .sb3” and load the downloaded file in the Scratch 3.0 editor with “File → Load from your computer”.

Is the code real Python?

It is a Python-style language built from Scratch blocks. Indentation, if, elif, else, while, for i in range(n) and def work as in Python, but there are no imports, classes or return, so the code will not run in a regular Python interpreter.

Are my projects uploaded anywhere?

No. Opening, converting and saving all happen in your browser, and the .sb3 file never leaves your device.

What happens to blocks pyScratch does not support?

Scripts with unknown blocks stay in the project and go back into the saved .sb3 unchanged. The code editor marks them with a comment, and you cannot change them there.

Does pyScratch work with old Scratch 2.0 (.sb2) files?

No, only with Scratch 3.0 (.sb3) files. Open an old .sb2 project in the Scratch 3.0 editor first and save it again to get an .sb3 file.

pyScratch is open source (MIT): GitHub. Made by Ihor Sivochka, sivochka.com. · Privacy policy