Online JavaScript Compiler
Run JavaScript online in an isolated browser sandbox. See console output, errors and execution time instantly, with top-level await and stdin input.
Runs in your browser · Nothing uploaded · No sign-up
Something not working, or missing a feature? Send feedback
About the JavaScript Compiler
The JavaScript Compiler runs code in a fresh, isolated Web Worker with network access removed, so you can try snippets, algorithms and interview questions safely. console output, errors and timing appear instantly. Use it as an online JavaScript compiler or a quick JS runner: write code, click Run and execute JS online without Node.js or a browser console.
Your code runs in an isolated Web Worker in your browser, so it never leaves your device.
How to use the JavaScript Compiler
- Write or paste JavaScript (or start from the sample).
- Add input in the stdin box if your code reads it with prompt() or readline().
- Click Run and read the console output, errors and execution time.
Example
Input
const name = readline() ?? 'world';
console.log(`Hello, ${name}!`);
const scores = [72, 95, 88];
const average = scores.reduce((a, b) => a + b, 0) / scores.length;
console.log('Average:', average.toFixed(1));Result
Hello, Ada! Average: 85.0
With "Ada" in the stdin box. readline() returns one line of stdin per call and null when there are no more lines.
Common mistakes
- import and require. Code runs as a single script without a module system, so import statements and require() are not available. Paste helper functions into the editor instead.
- document and window. Code runs in a Web Worker, which has no page. DOM APIs such as document.querySelector are undefined; use the HTML Viewer for DOM experiments.
- Undeclared variables. Code runs in strict mode, so assigning to a name without let, const or var throws a ReferenceError instead of creating a global.
Works well with the JavaScript Compiler
- TypeScript Compiler: add types and have them checked before running.
- JavaScript Formatter: format the code before sharing it.
- Regex Tester: try out the regular expressions your code uses.
Frequently asked questions
Can my code make network requests?
No. fetch, XMLHttpRequest and WebSocket are disabled inside the sandbox, and each run has a time limit.
Which JavaScript version is supported?
Whatever your browser supports, which for current browsers includes the latest ECMAScript features such as top-level await inside async code.
Can I use await?
Yes. Your code runs inside an async function, so await works at the top level.
Is it Node.js?
No. It is your browser’s JavaScript engine, so Node APIs such as fs, process and Buffer are not available, but all standard language features are.
Is JavaScript compiled or interpreted?
Both, in a way. Engines such as V8 (Chrome, Node.js) and SpiderMonkey (Firefox) start running your code in an interpreter and compile frequently used functions to machine code just in time. There is no build step you run yourself, so an online JavaScript compiler simply runs your code.
How is this different from the browser console?
Each run starts in a fresh, isolated Web Worker, so variables from an earlier run don’t linger and the page, its cookies and storage are out of reach. Network access is removed, a stdin box feeds input to your program, and a time limit stops runaway loops.
How do I read input in JavaScript online?
Type it into the stdin box before you click Run. prompt() and readline() return one line at a time (null when the input runs out), and the stdin variable holds the whole input as a single string.
Guides and tutorials
- Programming Languages
The JavaScript Event Loop: Promises, setTimeout and Microtasks in Practice
Why setTimeout(fn, 0) runs after promises, how await pauses, why busy loops delay timers, and how to run async work in sequence or parallel, with tested output.
· 6 min read
- Code Quality & Workflow
Regular Expressions for Developers: 12 Patterns You'll Actually Use
Tested regular expressions for emails, dates, UUIDs, versions and logs, plus groups, lookaheads, greedy vs lazy matching and catastrophic backtracking.
· 6 min read
Related tools
TypeScript Compiler
Compile and run TypeScript online. Your code is type-checked with the official compiler in strict mode, then runs in a sandboxed worker in your browser.
Python Compiler
Run Python 3 code online with the full standard library and stdin input. It runs in your browser with Pyodide (WebAssembly), so your code stays on your device.
PHP Compiler
Run PHP 8.4 code online and see the output instantly, with stdin input and mbstring. PHP runs in your browser with WebAssembly, so your code stays private.
C Compiler
Compile and run C code online with Clang 21, a GCC-compatible compiler: pick C89 (ANSI C), C99, C11, C17 or C23 and add stdin input. Your code stays private.
C++ Compiler
Run C++ code online for free: compile C++20 with Clang 21 and libc++, type stdin input and see the output. It runs in your browser, so your code stays private.
C# Compiler
Run C# code online with Roslyn and .NET 10: C# 14, top-level statements, LINQ, records and Console.ReadLine input, in your browser, so code stays private.