Limitations of Scratch
Project (general)
- Title maximum length: 100 characters.
- project.json uncompressed file size limit: 5 MB
- Individual asset (costume or sound) file size limit: 10 MB
- There is no limit on sb3 file size.
- There is no limit on block count but due to the project.json size limit, expect that 20000-30000 blocks can fit within it.
- Project framerate: 30 FPS
- Threads have a time limit of 500 ms. (encountered most often with custom blocks set to "run without screen refresh") Source code
- The numbers (not strings) Infinity, -Infinity, NaN, and -0 can not be saved in JSON.
- Scratch is mostly case-insensitive. Notably sprite and costume names are case-sensitive.
- The project displays layers in the order: backdrop, video, pen, sprite. Source code
Sprites
- Sprites are visually snapped to a grid sized with 480x360 steps on the screen.
- Size is limited by the current costume, when scaled it must not be visually larger than 150% the size of the stage (720x540) on any axis or smaller than 5 pixels on any axis. Source code
- The maximum number of clones that can exist at one time is 300. This limit is shared by all sprites. Source code
- Sprites can not be positioned off-screen with a margin less than 15px still showing. Source code
- Clones do not have an accessible unique ID and there is no native way to identify or share data between them. You need to implement this yourself with variables and lists. Note that those set to "for this sprite only" will store values unique to every clone/sprite, useful for an ID.
Costumes/backdrops
- There are two kinds of images supported - bitmap (raster) and vector. Images internally can only be stored as PNG, JPG, and SVG.
- Adding an image via the project editor will cause it to be sanitized/reencoded.
- The editor supports bitmap images with dimensions up to 960x720. Images that are 480x360 or smaller will be sized so that each pixel aligns to sprite positions and the pen layer. Images larger than that will be scaled 50% without loss of detail. The size is controlled by bitmapResolution internally (either 1 or 2).
- JPG, BMP, or GIF files will be converted to PNG. Some image metadata will be lost. Each frame of a GIF will be added as a separate PNG costume.
- Files encoded as PNG may be poorly compressed.
- Some features of SVG are removed. Embedded images using data URIs are OK. Source code
- Do not trust the file extension of an image processed by Scratch as it may be different to the file contents. If you need to know the file type, look at its contents or use a file reader capable of detecting it.
- If an edit is made to a bitmap costume, that costume will be saved as a PNG.
- If you want to avoid the editor's conversion (such as to import a better-compressed PNG or a JPG), you have to add/edit it outside of the editor.
- Vector costumes get rasterized in the project player to dimensions no more than 2048x2048. This results in very large vector costumes appearing blurry. Source code
Looks
- The color effect gives the sprite a minimum lightness and saturation. Source code
- The "fisheye", "whirl", and "pixelate" effects are always relative to the center of the costume.
- There is no "saturation" effect. Workarounds may involve multiple costumes or layering stamps or clones.
Control
- The "repeat" loop evaluates the input every iteration, although it only uses the initial result in determining the number of times to loop. Example project
- The "for each" loop compares the value in the repeat input every iteration. It is not stored. This is unintuitively unlike the "repeat" loop which will repeat the number of times given initially. Source code
- "Stop all" will not immediately stop broadcasts that were just scheduled to run, they will run for 1 frame and may trigger other scripts that can run longer than that.
- "Stop other scripts in sprite" marks scheduled scripts to not run but will keep their order in the queue. They can still be reactivated within the same frame and will keep their order instead of being added to the end (and run last).
- The "wait () seconds" block will only wait a whole number of frames which may deviate significantly at small numbers. A wait of 0 seconds will instead be 1 frame.
Sensing
- The keys that can be detected are here. Special keys such as shift, control, and backspace can not be detected. The mouse scroll wheel will trigger up/down arrow key hats but not the boolean reporters.
- Left-click is the only mouse button that can be detected.
- The mouse position is clamped to the edge of the screen and rounded. Source code
- Multi-touch (for touch-screens) is not supported. There is only 1 mouse pointer.
- The timer only updates once per frame. For sub-frame timing, use the "days since 2000" block.
- Touching color precision is limited to 5 bits red, 5 bits green, 4 bits blue. (this is only 14-bit color, much less than 24-bit RGB that is displayed by Scratch). Source code
- For the touching color blocks, the GPU will be used if there are more than 4000 pixels of the overlap in the touching area which may affect performance and change its behavior. Source code
Operators
- The "less-than", "greater-than", and "equals" blocks compare the inputs as floating point numbers if they can be casted. Long strings consisting of numeric characters may be compared in an unexpected way due to the numbers they are casted to (such as Infinity). This is also a problem with list "contains" and "item # of" blocks. Source code
Events
- Broadcasts can only run once per frame.
- Broadcast receiver hats do not accept reporter blocks, the message selection is a field and you can only choose from the created messages.
Variables and lists
- Supported data types: booleans, IEEE-754 double floats, strings. Through hacks it's possible to utilize a few other types such as arrays.
- List item limit: 200000 Source code
- There is no Scratch-imposed limit on string character count in variables and list items.
- Lists are 1-indexed. Item numbers count from 1.
- Variables and lists can not be created at runtime; they must be created manually by the user. There is no way to place a reporter block in the variable or list name. Scratch also does not have dictionaries (or other similar collections).
- Variable and list monitors are always displayed in front of everything on the screen. They are also not included in project thumbnails.
Custom blocks
- Custom blocks are not shared across all sprites. There must be a definition in every sprite that needs it.
- Argument reporters are only usable within their own definition script and always return 0 when run outside it. This includes clicking to run.
- There is no return statement or reporter-shaped custom blocks. The typical workaround for returning a value is to set a variable in the custom block script. The "stop this script" block can be used to return early.
Cloud variables
- 10 cloud variables per project. Source code
- Setting the value of any cloud variable has a shared average rate limit of 10 times per second. Source code
- Variables may either store a floating point number (NaN and infinity excluded) or a string containing numerical digits 0-9, up to a length of 256 characters.
- Calculated from the above limits, the maximum data transfer rate is approximately 1000 bytes/sec.
- Users with "New Scratcher" status can not set cloud variables with values that other users can see.
Sound
- Accepted file formats: WAV and MP3. Stereo audio allowed. Note that if an edit is made to a sound, that sound will be saved as a mono WAV. It may be downsampled to 22.05kHz if over the 10MB file size limit. I recommend making edits in software other than Scratch so the file is always transferred to Scratch as MP3 (where necessary). Other file formats may be added by editing the project externally but their support depends on the browser.
- Volume range: 0 to 100% Source code
- Pitch effect range: -360 to 360 Scratch Wiki
- Pan effect range: -100 to 100 Scratch Wiki
- Volume and effects are controlled per sprite/clone.
- Sounds played with the "play sound" block can only be stopped with the "stop all" and "stop all sounds" blocks, there is no way to stop an individual sound here. Sounds played with the "play sound until done" block can be stopped with "stop other scripts in sprite" or by deleting the clone if it was running in a clone.
- A sound can not be played multiple times simultaneously. Clones share the original sprite's sound file. The sound may be duplicated in the sounds editor (or added to a different sprite) if playing it simultaneously is desired.
- The set/change volume and set/change effect blocks will cause a yield. Source code (volume) Source code (effect)
- The first time the sound is played will have it briefly play at full volume. This is unavoidable. Other than ignoring it, the best way I found is to edit a short fade-in at the start of the audio file.
- There may be a slight delay when the sound is first played as it gets loaded.
- Sounds played with "play sound until done" are not guaranteed to loop seamlessly if played again immediately in a loop.
Pen extension
- The pen layer (internally called "skin") is in front of the stage but behind all sprites. Source code
- Dimensions: 480x360
- There is no way to erase a stroke or only part of the pen layer. There is only an "erase all" block.
- Pen "size" is its diameter in pixels and is limited to between 1 and 1200. Source code
- A pen size of exactly 1 or 3 will offset the pen position to the top-right by 0.5 steps to be "pixel-aligned". Source code
- An ARGB color value with full transparency is not possible as the way the value is handled always ignores alpha. If converted to a number (e.g. from hexadecimal), the leading zeroes for alpha will be lost. If converted from a hex color code such as #FF3000, alpha handling isn't implemented. If setting pen color, it is suggested to either use the set pen transparency effect after setting the RGB color or ensure the ARGB value never uses an alpha of 0 (possibly clamp to 1). Otherwise, conditionally draw pen strokes.
- The "set pen color" block can't set all RGB colors. The color may differ from the input. For example, 0f0f0f becomes 0e0e0e. It is still possible to draw such colors using stamps or using the other blocks to set the pen color. More info
- Every pen stroke is drawn independently of others; semi-transparent pixels from anti-aliasing or a semi-transparent pen color will be drawn visibly overlapping.
Music extension
- Duration in beats can only be between 0 and 100. Source code
- Tempo can only be between 20 and 500. Source code
- A maximum of 30 instrument sounds can be played simultaneously. Source code
Site
- Usernames can only be chosen with a length between 3 and 20 (inclusive). Characters are limited to the english alphabet (case insensitive), numbers 0-9, the underscore _ and dash -. Note that there are some usernames that do not fit these requirements, they may have been set by the Scratch Team or created before some requirements were made. Most of the invalid ones are not in use, see for example this topic of unusual usernames. Generally, users can not change their username.
Thanks to Vadik1 and Bambozzle for contributing some of the above items.