Home/Developer Tools/JavaScript Playground
🧪

JavaScript Playground

FREE

Run JavaScript and see console output instantly

Free · No sign-up required
Loading...

What the JavaScript playground does

Type or paste JavaScript, run it, and see the output — console.log calls, return values and errors — in a panel beside the code. No project setup, no Node install, no signing in. It is the fastest way to test a regular expression, check how an array method behaves, try a snippet from documentation, or reproduce a bug in isolation. The code runs in your browser's JavaScript engine; nothing is sent to a server.

What you can use

AvailableNot available
All of modern JavaScript (ES2024): classes, async/await, destructuring, optional chaining, BigInt, IntlNode.js APIs — require, fs, process, Buffer
Browser globals — fetch, setTimeout, JSON, Math, Date, crypto, localStoragenpm packages — no import from node_modules
console.log / warn / error / table, shown in the output panelDOM of the page — the code runs in isolation from the tool's own UI
Errors with line numbersPersistent state — everything resets on each run

Example: things it is good for

// Check a regex console.log("2026-06-14".match(/(\d{4})-(\d{2})-(\d{2})/).slice(1)); // Explore an array method console.log([3, 1, 2].toSorted()); // [1, 2, 3] — original untouched // Date and Intl behaviour console.log(new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(1234.5)); // Async const r = await fetch("https://api.github.com/zen"); console.log(await r.text());

Top-level await works, so you can call fetch against public APIs directly (subject to CORS). console.table renders arrays of objects as a grid.

Playground vs the browser console

  • The console evaluates one line at a time; the playground runs a whole script and keeps it visible for editing and re-running.
  • The console runs in the context of the current page (its DOM and globals); the playground runs isolated, which is cleaner for pure logic.
  • The playground shows all output together, which is easier to read for loops and async sequences.
  • For DOM work, use the Real-Time HTML Editor, which pairs HTML, CSS and JavaScript with a live preview.

Common uses

  • Testing a regular expression against sample strings before putting it in production.
  • Checking edge cases: what parseInt("08") or [] + {} returns.
  • Prototyping a data transformation on a pasted JSON sample.
  • Learning — trying examples from MDN or a tutorial with immediate feedback.
  • Reproducing a bug in a minimal snippet to attach to an issue.
  • Quick calculations that are easier in code than in a calculator.

Safety

Code runs with the same permissions as any script on this page: it can make network requests and use browser storage. Do not paste and run code you do not understand from untrusted sources, and do not put real credentials in the editor. Infinite loops will freeze the tab — reload if that happens, and add a counter or a timeout when experimenting with while.

Frequently asked questions

Why does fetch to my API fail?

The API must allow cross-origin requests (CORS). Public APIs usually do; your own server needs an Access-Control-Allow-Origin header, or test from the browser console on your own site instead.

Can I import a library from a CDN?

Dynamic import works for ES modules served with CORS headers: const _ = await import('https://cdn.jsdelivr.net/npm/lodash-es'). Classic scripts that attach to window are not loadable.

Is my code saved?

No. Copy it before leaving the page. Nothing is stored or transmitted.

Why do I see 'undefined' as output?

That is the value of the last expression. Use console.log to print specific values.

Can I run TypeScript?

No — plain JavaScript only. Strip the types or use the TypeScript playground on typescriptlang.org.

Does it support ES modules syntax?

import/export at top level is not supported; use dynamic import() for external modules.

More tools in this category

📋
JSON Tools
View tree, format, validate and minify JSON
📄
YAML Beautifier & Validator
Format YAML and find the line that breaks it
📋
XML Tools
Beautify, validate and convert XML to JSON
🗃
SQL Formatter & Minifier
Lay out SQL clause by clause, or collapse it to one line
📝
Markdown Tools
Preview Markdown, convert to HTML and generate tables
🔑
JWT Encoder & Decoder
Decode a JWT's header and payload, or sign one with HS256