Skip to content

JavaScript Playground

Run JavaScript in a sandboxed frame and read the console output on the page.

Runs in your browserNo account neededFree
Loading tool…

Processing: This tool runs entirely in your browser. Your input and any file you open stay on your device — nothing is uploaded to a server.

How to use the javascript playground

  1. Write or paste JavaScript.
  2. Press Run; output appears in the console below.
  3. Read errors there too — uncaught ones are captured.

About this tool

Write JavaScript, run it, and read what it logged. Uncaught errors and unhandled promise rejections are captured too, so code that fails silently in a console somewhere shows its failure here.

The result runs in a sandboxed frame with `allow-scripts` and deliberately without `allow-same-origin`. Those two together let the frame reach back into the page that hosts it, its storage and its cookies — granting both is the standard way a sandbox gets quietly undone, and it is a common mistake in tools of this kind. Without same-origin the frame has an opaque origin: your code runs, and can see nothing of the page around it. Console output crosses that boundary by message passing, which is the only channel an opaque origin has — the frame cannot write to this page directly, so it tells the page what to display instead.

Automatic running is off by default here, and that is a practical choice rather than a security one: a half-typed loop re-run on every keystroke freezes the tab. Press Run when the code is ready.

The code has real access to the frame's own document, so DOM work behaves properly, and modern syntax works because it is the browser's own engine rather than a transpiler. What it does not have is any access to yours.

Common uses

  • Testing a snippet without opening developer tools.
  • Checking what a piece of code actually logs.
  • Trying an API you are unsure about.

Frequently asked questions

Can the code access this page?
No. The frame is sandboxed without same-origin access, so it has an opaque origin and can see nothing of the page, its storage or its cookies.
Why does it not run as I type?
Because a half-finished loop re-run on every keystroke freezes the tab. Automatic running can be switched on if you want it.
Does modern syntax work?
Yes. It runs on the browser's own engine with no transpiling, so whatever your browser supports is what works.

Related tools