Code Editor (Monaco)
A code editor in the browser built on Monaco, the editor component of VS Code: more than 80 languages with syntax highlighting, autocomplete, find and replace, multi-cursor and the F1 command palette. Run JavaScript, TypeScript, Python, HTML, CSS, Markdown and SQL in place, format with Prettier, compare tabs in a diff view, and share a session as a link.
How to Use
- Wait a moment for the editor to load from the jsDelivr CDN (the browser caches it after the first visit). A
scratch.jstab opens with a small Fibonacci example. - Type or paste code, or press Import (or drop files on the editor) to open each file as a new tab, with its language picked from the file extension. A Samples button opens a ready-made example (JSON, regex, HTML + CSS, Python, SQL or TypeScript) in its own tab and runs it.
- Choose a Language and a Theme. The readouts under the editor show the language, the line count, the size in UTF-8 bytes and the last action.
- Press ▶ Run (Ctrl/Cmd+Enter) for JavaScript, TypeScript, Python, HTML, CSS, Markdown or SQL, or Format (Ctrl/Cmd+Shift+F) to tidy the code. Show Work below records what happened, with the sizes before and after.
- Keep your work with Download (Ctrl/Cmd+S), Share Link, or Export, which saves every tab as one session.json. Tabs also save themselves in this browser as you type.
Worked Example
Running the sample. The editor opens with scratch.js: 301 bytes on 11 lines (10 line breaks + 1). Press Run and the sandboxed iframe prints 55, the 10th Fibonacci number. The recursive fib calls itself 2 × F(11) − 1 = 2 × 89 − 1 = 177 times to get there; fib(40) would need 331,160,281 calls.
Formatting. With the language set to JavaScript, const a={b:1,c:[1,2,3]} (23 bytes, 1 line) becomes const a = { b: 1, c: [1, 2, 3] }; plus a final newline: 34 bytes on 2 lines. Prettier added the spaces, the semicolon and the newline, and Show Work records “23 B → 34 B, 1 → 2 lines”.
The common mistake: reading the size as a character count. The size readout counts UTF-8 bytes. café is 4 characters but 5 bytes, because é takes 2; 😀 is one character, 4 bytes, and 2 UTF-16 code units, which is why JavaScript says "😀".length is 2. A share link counts bytes too: café becomes 4 × ⌈5 ÷ 3⌉ − 1 = 7 characters, Y2Fmw6k.
Show Work
Formulas
Keyboard Shortcuts
What Run and Format Do
From VS Code to a Browser Tab
Monaco began at Microsoft as a code editor that ran inside a web page, built by a team in Zurich led by Erich Gamma (one of the “Gang of Four” authors of Design Patterns). The same component became the editing surface of Visual Studio Code, announced in April 2015, and in 2016 Microsoft published it on its own as the open-source monaco-editor package. That is why this page has VS Code’s keyboard shortcuts, multi-cursor editing and F1 command palette.
The runners come from projects that brought other languages into the browser. Pyodide started at Mozilla in 2018, compiling CPython and its C extensions to WebAssembly with Emscripten; sql.js does the same for SQLite. Prettier, released by James Long in 2017, formats by parsing the code into a syntax tree and printing it again from scratch, which is why it settles style arguments but cannot format code that does not parse.
About This Tool
This is a full code editor in a page: Monaco with more than 80 languages, tabs that save themselves, a diff view, Prettier formatting and in-place runners for seven languages. Unlike a plain text box it understands the code it shows, and unlike an online IDE it needs no account and keeps nothing on a server. The readouts and Show Work report what the editor knows about the open tab, including the exact UTF-8 size that a download or share link will carry.
The editor, runtimes and themes download from the jsDelivr CDN; your code stays in this browser.
It suits quick experiments, checking a snippet before pasting it elsewhere, teaching, and anyone who wants VS Code’s editing on a machine where they cannot install it.
Related tools: Minifier / Beautifier, Text Diff Tool, and JavaScript Obfuscator.
Frequently Asked Questions
Does my code leave the browser?
No. The editor and the language runtimes are downloaded from the jsDelivr CDN, but your code is never uploaded: it runs on this page and is saved in this browser’s IndexedDB storage, 400 ms after you stop typing. A share link carries the code after the # in the address, and browsers never send that part to a server.
Which languages can I run?
Seven. JavaScript runs in a sandboxed iframe with console output captured and an 8-second limit; TypeScript is transpiled to ES2020 by TypeScript 5.3 and then run the same way; Python runs in CPython 3.12 compiled to WebAssembly (Pyodide 0.26, a large download the first time); HTML shows a live preview; CSS is applied to a sample page; Markdown renders with marked 11; SQL runs against an in-memory SQLite database (sql.js 1.10) and shows the rows as a table. The other languages are for editing only.
How long is a share link?
The code is stored as base64url, which spends 4 characters on every 3 bytes, so a link is about a third longer than the code. The 301-byte example becomes 4 × ⌈301 ÷ 3⌉ − 2 = 402 characters, plus the language and theme. Very long files make very long links, so use Download or Export for those.
Why did Format do nothing?
Format uses Prettier 3.2 for 11 languages (JavaScript, JSX, TypeScript, TSX, JSON, CSS, SCSS, Less, HTML, Markdown and YAML) and sql-formatter for SQL; other languages have no formatter. Prettier rebuilds the code from its syntax tree, so the code has to parse first: const a = { fails with “Unexpected token (1:12)” and is left unchanged. Show Work says which case happened.
Are my tabs kept if I close the page?
Yes, in this browser. Every tab, with its name, language and content, is written to IndexedDB, so it is still there after a reload or a restart. Clearing site data removes it, and other browsers or devices do not see it. To move work elsewhere, Export saves all tabs as one session.json, and importing that file restores them.
How do I use the Code Editor (Monaco)?
Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Try a snippet
Paste a JavaScript function and press Run: the sample’s fib(10) prints 55.
Tidy pasted code
Format turns const a={b:1,c:[1,2,3]} (23 bytes) into const a = { b: 1, c: [1, 2, 3] }; (34 bytes with the final newline).
Query test data
Run CREATE TABLE, INSERT and SELECT as SQL against an in-memory SQLite database and read the rows as a table.
Share a snippet
The 301-byte sample becomes a link carrying 402 characters of code, with nothing stored on a server.
Compare two versions
Open both as tabs and press Diff to see them side by side or inline, ignoring whitespace if you like.
Last updated: