How to use the code playground
- Choose a language. HTML, CSS and JavaScript gives you three tabs and a live preview. The others give you one file and a console.
- Type your code, or pick a starting point from Templates.
- Web pages update as you type. For the other languages press Run, or Ctrl+Enter (Cmd+Enter on a Mac).
- Use Share Code to copy a link that opens your code in this editor, or Download to save it as a file.
What you can run
| Language | What you get |
|---|---|
| HTML, CSS and JavaScript | Three tabs and a live preview of the page, with a console for console.log and errors. |
| JavaScript | A console for pure JavaScript, without a page. Good for practicing logic, functions and arrays. |
| Python | Real Python 3.12 with its standard library. Answers for input() come from the Input box. |
| TypeScript | TypeScript 5.9 with type checking. Type errors are shown with their line number before the code runs. |
| SQL | A SQLite database with three practice tables. Results are shown as tables, and every run starts fresh. |
| Lua | Lua 5.3 with print, strings, tables and math. A small language that is popular in games. |
The first time you run Python, TypeScript, SQL or Lua, the page downloads that language's engine (about 5 MB for Python, 1 MB for TypeScript, and less for SQL and Lua). Your browser keeps it, so later runs start quickly.
Your code runs in a sandbox
Everything you run stays inside a locked-down frame in your own browser. Code in the playground cannot read your saved data on this site, cannot reach the internet, and cannot open windows or move you to another page. Nothing is uploaded: there is no server that runs or stores your code.
Because of that, a few things work differently from a normal page: links in the preview do not open, forms are not sent, fetch() is turned off, and pictures can only come from the built-in practice set (cat.svg, dog.svg, mountain.svg, logo.svg) or from data: addresses.
Sharing code safely
Share Code packs your code into the link itself, after the # sign. That part of an address is never sent to a server. Whoever opens the link gets the code in the editor, and nothing runs until they press Run. Shared code is never shown as a web page of its own.
Saved as you type
The playground keeps one draft per language in your browser, so you can close the tab and continue later. Use Download for anything you want to keep for good.
New to coding?
The Learn to Code courses teach HTML, CSS, JavaScript, Python and SQL step by step, with exercises that are checked as you go.
Frequently asked questions
Which languages can I run?
HTML, CSS and JavaScript, JavaScript, Python, TypeScript, SQL and Lua.
Is my code uploaded anywhere?
No. Your code runs in your browser and is saved only on your device. Shared links carry the code inside the link itself.
Why do links and fetch() not work in the preview?
The preview is a sandbox with network access turned off, so code in it cannot load or send anything. This keeps the playground safe to use, including with code someone shared with you.
Can I install Python packages such as NumPy?
Not at the moment. The playground includes the Python standard library, which covers math, random, datetime, json, re, collections and much more.
What happens if my code never stops?
Code that runs for too long is stopped automatically, and there is a Stop button to end it yourself.
Does it work on a phone?
Yes, though typing code is much more comfortable with a real keyboard.