Code Playground — run JavaScript or preview an HTML page, all locally
Code Playground
Experiment with code without leaving the page. The JavaScript console mode executes your
snippet inside a locked-down sandbox and streams console.log / warn / error output back with
colors; the HTML preview mode renders a full HTML + CSS + JavaScript page live and lets you
download it as a file. No server, no upload — a broken snippet (even an infinite loop) can always be
stopped and can never touch the rest of the page. Related utility: Language Detector.
JavaScript code
HTML + CSS + JavaScript
Safety model. Both modes run inside an iframe sandbox that only permits scripts:
no same-origin access, no forms, no pop-ups and no downloads from inside the sandbox, so your snippet cannot
touch this page, your files or other tabs. JavaScript runs in an isolated process, so Stop
interrupts a running snippet and this page keeps responding; if a run takes unusually long the page offers Stop
automatically. Note that a truly infinite loop keeps its sandbox process busy even after Stop — if the
next run shows no output, refresh the page to recover. The HTML preview's
Download Page saves the source as a local .html file.
How a browser sandbox runs your code
The preview pane is a sandboxed iframe: a separate browsing context that cannot reach the parent page’s DOM or cookies. Your script’s console output is captured and mirrored back so errors are visible without opening dev tools — and everything runs in your browser, never on a server.
Sandboxing is a security boundary, not a cosmetic one — code you paste here cannot touch this site or your other tabs.
🔧 Code & Dev Tools
Small code and developer utilities that run entirely in your browser.