Edit HTML, CSS and JavaScript and run them live in a sandbox with a console
JavaScript Playground
Test a snippet, check how a function behaves or try an API, and see the console output straight away.
Loading tool…
How to use javascript playground
Type JavaScript or pick an example: arrays and objects, async code, errors or dates.
Watch the console update as you type, or turn auto run off and press Run.
Read logged values, warnings and errors with their line numbers.
Press Stop to cancel timers that are still running.
What this tool does
- Runs code as a module, so top level await works without wrapping it in a function.
- Shows objects, arrays, Maps, Sets, dates and errors in readable form, with printf style %s, %d and %o support.
- Supports console.table, console.assert, console.count and console.time.
- Runs in a sandboxed frame with no access to this site, your storage or the network.
How the result is verified
Output comes from the browser's own JavaScript engine running your code. Each run gets a fresh frame and a new id, so messages from a previous run are ignored.
Frequently asked questions
Which JavaScript version does it support?
Whatever your browser supports, since your browser runs the code. Current Chrome, Edge, Firefox and Safari all handle modern syntax such as optional chaining, classes with private fields and top level await.
Why does my fetch call fail?
The playground blocks every network request so code you paste cannot send data anywhere. A warning in the console tells you when something was blocked.
Is my data uploaded to a server?
No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.
Related tools
Live regex matching with groups, flags and a replace preview
Beautify or minify JSON with your choice of indentation
Highlighted code pictures with themes and backgrounds, saved as PNG or SVG