JavaScript Formatter
Make minified or badly formatted JavaScript readable again.
Runs in your browser — nothing you type is sent anywhere
Indentation
Formatted
The result appears here as you type. Nothing is sent anywhere — the work happens in this page.
Modern syntax is understood, including JSX, async/await, optional chaining and class fields. The code is parsed, never executed — formatting something you do not trust is safe.
About the JavaScript Formatter
Minified JavaScript is deliberately unreadable — every unnecessary character removed, statements joined, and often variables renamed to single letters. Formatting it will not undo the renaming, but it restores the structure, which is usually enough to follow what a function does.
The formatter understands modern syntax: JSX, async and await, optional chaining, class fields, generators, template literals and the rest. Code that a formatter built for older JavaScript would refuse goes through without complaint.
The code is parsed, never executed. That matters if you are formatting something you do not trust — a script pulled off a page, or a file you were sent. Parsing turns it into a syntax tree and prints it back; nothing in it ever runs.
If the code will not parse, the error is shown with what the parser objected to. That doubles as a syntax check: a file that formats is a file that at least parses.
The parser is downloaded only when you press the button, and runs on your device. Nothing is uploaded, which matters because pasted code often includes API keys and endpoints that should not be handed to a third party.
How to use the JavaScript Formatter
Paste your JavaScript
Minified, badly formatted or just inconsistent. JSX and TypeScript-free modern syntax are both fine.
Choose the indentation
Two spaces, four spaces or tabs.
Format it
If it will not parse, the error says what the parser objected to — which doubles as a syntax check.
Copy or download
Take it to the clipboard or save it as a .js file.
Frequently asked questions
Will it restore my original variable names?
Is it safe to format code I do not trust?
Does it handle modern syntax?
Does it work for TypeScript?
Is my code uploaded?
You may also need
JSON Formatter
Format, validate and minify JSON — with the exact line and column of any error.
HTML Formatter
Indent minified or messy HTML into something readable.
CSS Formatter
Expand minified CSS back into readable rules.
Base64 Decoder
Decode Base64 back to text, accepting URL-safe input, missing padding and stray whitespace.