How to use it
- Paste your JavaScript, open a
.jsfile, or start from the sample: minified code. - Choose 2 spaces, 4 spaces or tabs. The formatted code appears as you type.
- Copy it or download it as
script.js.
What it does
Statements go on their own lines, blocks are indented, and spacing around operators and after keywords is made consistent. The code does exactly the same thing: only whitespace changes. Formatting can't bring back names a minifier shortened, like n and t, or the comments it removed.
When it helps
- Reading a minified script to see what it does, or to find where an error comes from.
- Tidying code from a snippet, an answer or an AI assistant before you edit it.
- Making two versions comparable before a diff.
Frequently asked questions
Does it work with modern JavaScript?
Yes: arrow functions, classes, template literals, async/await, optional chaining and modules all format.
Does it check my code for errors?
No. It indents what's there, even if it wouldn't run. The JavaScript Minifier does parse the code, and reports the line and column of a syntax error.
What about TypeScript or JSX?
Most TypeScript formats fine, since it's JavaScript with type annotations. For JSX and large projects, use Prettier in your editor.
Is my code uploaded?
No. Formatting runs in your browser.