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
- In the Scratch editor, choose “File → Save to your computer” to get the .sb3 file of your project.
- In pyScratch, choose “File → Open .sb3”, or simply drag the .sb3 file onto the page.
- 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.
- Edit the code and press the green flag (or Ctrl+Enter) to run the project on the stage.
- 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
- It is not full Python:
import, class, return, break, continue, lambda, try/except, with, f-strings, ** and the a if b else c expression are not supported, and the compiler tells you so.
- Non-standard third-party Scratch extensions stay in the project and are saved unchanged with a comment in the editor. For the 5 built-in robotics/hardware extensions (WeDo 2.0, micro:bit, EV3, BOOST, Go Direct), browsers without Web Bluetooth or without a paired device safely return Scratch defaults (
0 / false).
- The built-in stage is an offline Canvas 2D simulator:
translate() returns text unchanged because the preview never goes online, and minor differences from Scratch’s WebGL renderer can occur. Always verify final projects in Scratch.
- Compiler error messages, block tree labels, and converter code comments are localized in five languages: Ukrainian, English, Polish, Russian, and Korean.
Update history & roadmap
Already shipped
- v1.12.0 — New project button (in File menu and tab bar), 1:1 Scratch 3.0 Stop / Green Flag semantics, direction normalization to
(-180, 180], live Stage thumbnail sync, redesigned vector mascot/backdrops & full mini-project templates, SVG viewBox fix, and palette UI polish.
- v1.11.0 — 1:1 Scratch 3.0 UX/UI redesign: + Extension Library modal with auto-detection, fixed Sprite Pane & larger Stage buttons, visual Costumes & Sounds viewer (thumbnails, checkerboard, center crosshair, Canvas waveform), and authentic compact Scratch 3.0 Blocks with C-blocks & input pills.
- v1.10.0 — full Asset Manager (delete, audio preview, and reorder costumes, backdrops, and sounds with safe shared-asset cleanup) plus offline Code Autocomplete / IntelliSense (commands,
@when_* decorators, 5-locale tips, variables, lists, and custom def blocks).
- v1.9.0 — all 5 official Scratch 3.0 hardware extensions (53 blocks): LEGO WeDo 2.0, micro:bit, LEGO MINDSTORMS EV3, LEGO BOOST, and Go Direct Force & Acceleration with 4-layer parity, lazy Web Bluetooth bridge, and safe offline defaults.
- v1.8.0 — full Video Sensing (live webcam, optical motion & direction sensing, video layer transparency,
@when_video_motion_greater_than) and Makey Makey (@when_makey_key_pressed, @when_makey_sequence_pressed) extension support.
- v1.7.0 — pixel-accurate costume hit-testing (
touching() & stage clicks), rotated/pivot-offset bounds for if_on_edge_bounce(), Canvas 2D fisheye and whirl pixel warping, and live Web Audio microphone input for loudness() and @when_greater_than("loudness", ...).
- v1.6.0 — Pythonic 1-based list & string syntax (
bag[i], bag[i] = val, in / not in, len(bag)) and bidirectional block comment round-trip (# ↔ target.comments).
- v1.5.0–1.5.2 — Scratch-exact HSB/HSV Pen engine, fast synchronous
@warp for 3D/Pen renderers, 5 interface locales (UK, EN, PL, RU, KO), and browser auto-translate protection on the code editor.
Planned next
- Next — interactive Scratch-to-Python lessons & landing page on
sivochka.com plus UX polish.
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.