Skip to content
Toolzy 100% free · no login

Home › Developer Tools › Online JavaScript Compiler

Online JavaScript Compiler

Runs in your browserFree · no sign-up

Write modern JavaScript and press Run. console.log output appears below. The code runs in an isolated Web Worker on your device and can be stopped at any time.

Ctrl + Enter runs the code. Tab indents; press Esc then Tab to move focus out of the editor.

Other languages: Python · SQL · Lua · HTML, CSS & JS playground

Advertisement

How to use this tool

  1. Type or paste JavaScript in the editor, or choose an example.
  2. Use console.log() to print. prompt(), readline() and input() read lines from the Input box.
  3. Press Run or Ctrl + Enter. Top-level await works, so you can test promises.
  4. Check the output, then share the code with a link or download it as a .js file.

A JavaScript console without the clutter

Browser developer tools are powerful, but they are not friendly for practising: they mix your output with page messages, and a typo can leave variables behind. This runner gives you a clean editor and a clean console. Every run starts fresh in a new Web Worker, a background thread with its own global scope and no access to this page, its cookies or its DOM. That makes it a safe place to try snippets you found online and a good fit for learning, interview questions and coding exercises.

What is supported

You get the full modern language your browser supports: let and const, arrow functions, classes and private fields, destructuring, spread, optional chaining, BigInt, Map/Set, generators, regular expressions and the Intl formatting APIs. Your code is wrapped in an async function, so top-level await works and you can test promises and timers. console.log, info, warn and error are captured, objects and arrays are printed as readable JSON, and an uncaught exception shows its message and the line in main.js.

Reading input

Many exercises read from standard input, as they would in Node.js. Put the lines in the Input box and call readline(), input() or prompt(); each call returns the next line, and null when the input runs out, so a while loop can read everything. There is no DOM in a worker, so code that uses document or window should go in the HTML, CSS and JS playground instead.

Stopping runaway code

An accidental infinite loop in a normal tab freezes the whole page. Here the editor stays responsive: press Stop, or let the time limit end the run, and the worker is terminated immediately. Node-specific modules such as fs and require() are not available because this is a browser engine, not Node.js. Share link encodes the code into the address after the # sign, so nothing is stored on a server.

Frequently asked questions

Is this the same as running Node.js?

The language is the same, but Node-only modules such as fs and require() are not available. Use readline(), input() or prompt() to read input lines.

Can I use async/await?

Yes. Code runs inside an async function, so top-level await, promises and setTimeout all work.

Why does document or window not work?

The code runs in an isolated Web Worker without a page. Use the HTML, CSS & JS playground for DOM code.

What happens with an infinite loop?

Press Stop or wait for the time limit. The worker is terminated and the page stays responsive.

Is my code sent to a server?

No. It runs in your browser. Share links keep the code inside the link itself.

More free tools