Runs 100% in your browser · no sign-up

Online JavaScript Compiler

Write JavaScript and run it instantly with a real console: expandable objects, tables, warnings and errors with line numbers. Async/await, timers and fetch work, and an infinite loop can never freeze the page.

JavaScript code editor and console

script.js

14px
Ln 1, Col 1 Saved

Console 0

Press Run or Ctrl+Enter. Output from console.log(), tables, warnings and errors appears here.

    Ready

    In short: what this JavaScript compiler does

    The SeeB4Coding Online JavaScript Compiler is a free, browser-based editor and console for running JavaScript. You write code, press Run, and see the output immediately. Nothing is installed, no account is needed, and your code is never sent to a server.

    • Real console: console.log, info, warn, error, table, group, count, time, assert and trace, with expandable objects, arrays, Map and Set.
    • Clear errors: uncaught errors show a stack trace with clickable line numbers, and syntax errors are marked in the editor as you type.
    • Modern JavaScript: classes, private fields, optional chaining, BigInt, generators, async/await and top-level await.
    • Async and network: setTimeout, setInterval, promises, fetch and libraries loaded from a CDN with import().
    • Safe by design: code runs in a Web Worker, so infinite loops are stopped after 5 seconds and never freeze the page.
    • Keep your work: autosave, examples, formatter, .js open and download, and share links.

    How to run JavaScript code online

    Three steps, about a minute.

    Write or paste your code

    Type in the editor, paste existing code, open or drop a .js file, or pick one of the examples. Syntax errors are underlined as you type.

    Run it

    Press Run or Ctrl+Enter. Everything your code logs appears in the console, including objects you can expand, tables, warnings and errors.

    Save, download or share

    Your code autosaves in this browser. Download it as a .js file, copy it, or create a share link that carries the code inside the URL.

    Features

    Everything you need to learn, test and debug JavaScript without setting up Node.js or a project.

    A console like DevTools

    Expandable objects and arrays, Map and Set, real console.table tables, groups, counters, timers and %s/%d/%o format strings.

    Loop protection

    Code runs on a separate thread. A script that stays busy for 5 seconds is stopped automatically, and Stop ends a run at any time.

    Async that just works

    Use await at the top level. The run stays active until pending timers and fetch requests finish, then shows how long it took.

    A real code editor

    Syntax highlighting, autocomplete, snippets, live syntax checking, multi-cursor, find and replace, code folding and a one-click JavaScript formatter.

    Ready-made examples

    Array methods, destructuring, closures, classes, promises, error handling, Map and Set, regex, Intl, fetch, CDN libraries and algorithms.

    Autosave & sharing

    Code stays in your browser between visits. Share links keep code after the #, which is never sent to a server, and shared code never runs until you press Run.

    What your code can use

    Your code runs in a Web Worker: the browser's full JavaScript engine, on its own thread, without a web page attached.

    JavaScript features available in the online compiler.
    FeatureWorksNotes
    Modern syntax (ES2015 and later)YesAnything your browser supports: classes, private fields, destructuring, optional chaining, BigInt, generators.
    async/await, top-level awaitYesThe console keeps updating until the last promise settles.
    setTimeout, setIntervalYesA run with an active interval keeps going until you clear it or press Stop.
    fetch() to public APIsYesThe API must allow cross-origin requests (CORS).
    Libraries from a CDNYesawait import("https://cdn.jsdelivr.net/npm/lodash-es@4/+esm") or importScripts(url) for classic scripts.
    Intl, crypto, structuredClone, TextEncoderYes—
    alert(), prompt(), confirm()Partlyalert prints to the console. prompt returns null and confirm returns false.
    document, window, DOM elementsNoThere is no page to change. Use the Online HTML Editor for DOM code.
    localStorage, cookiesNoNot available in workers. Keep state in variables.
    import x from "...", require()NoStatic imports and Node.js modules are not available. Use dynamic import() from a CDN.

    Keyboard shortcuts

    On macOS use ⌘ in place of Ctrl and ⌥ in place of Alt.

    Shortcuts available in the JavaScript compiler.
    ActionShortcut
    Run codeCtrl+Enter
    Format codeShift+Alt+F
    Save draft nowCtrl+S
    AutocompleteCtrl+Space
    Find / replaceCtrl+F / Ctrl+H
    Toggle commentCtrl+/
    Move line up / downAlt+↑ / Alt+↓
    Duplicate lineCtrl+Shift+D
    Delete lineCtrl+D
    Undo / redoCtrl+Z / Ctrl+Y
    Exit focus modeEsc

    Frequently asked questions

    Common questions about running JavaScript online.

    Is my JavaScript code uploaded to a server?

    No. Your code runs in a Web Worker inside your own browser. Autosave uses your browser's localStorage, and share links keep the code in the part of the URL after the # sign, which browsers never send to the server.

    Is this a real JavaScript compiler?

    It runs your code in the JavaScript engine that is already built into your browser: V8 in Chrome and Edge, SpiderMonkey in Firefox and JavaScriptCore in Safari. These engines compile JavaScript just in time, so the output is exactly what that browser produces. Nothing is transpiled.

    Which JavaScript features are supported?

    Everything your browser supports, including let and const, arrow functions, classes with private fields, destructuring, spread, optional chaining, BigInt, generators, Map and Set, Intl, async/await and top-level await. Static import statements are not supported; use dynamic import() instead.

    Why do I get "document is not defined"?

    Code runs in a Web Worker, which has no web page attached, so document, window and localStorage are not available. This keeps the editor safe and responsive. To work with HTML elements and the DOM, use the SeeB4Coding Online HTML Editor.

    What happens if my code has an infinite loop?

    The page stays responsive because the code runs on a separate thread. If the script is busy for more than 5 seconds without a break, it is stopped automatically and the console explains why. You can also press Stop at any time.

    Can I use async/await, setTimeout and fetch?

    Yes. You can use await at the top level, and setTimeout, setInterval, promises and fetch all work. The run stays active until pending timers and requests finish. fetch requires the API to allow cross-origin requests (CORS).

    Can I use npm packages such as Lodash or Day.js?

    Yes, from a CDN. Use dynamic import for ES modules, for example const { chunk } = await import("https://cdn.jsdelivr.net/npm/lodash-es@4/+esm"), or importScripts for classic scripts that create a global. require() and Node.js modules such as fs are not available in the browser.

    How does the console display objects and arrays?

    Objects, arrays, Map and Set are shown as expandable trees with a one-line preview, nested up to 5 levels deep. console.table renders a real table, and console.group, count, time, assert and trace behave like browser developer tools. Up to 1,000 messages are shown per run.

    How do I share my JavaScript code?

    Click Share. The code is compressed into a link and copied to your clipboard. Anyone who opens it sees the same code, and shared code never runs until they press Run.

    Does the JavaScript compiler work on mobile phones?

    Yes. On phones and small tablets the editor and console become two tabs, Code and Console, and running the code switches to the console automatically.

    Is the online JavaScript compiler free?

    Yes. It is completely free, needs no account, and has no limit on how much you use it.

    Other browser-based utilities from SeeB4Coding.