Free JavaScript Formatter

Beautify minified or messy JavaScript into readable, indented code, entirely in your browser.

This is a lightweight, brace-based indenter (not a full parser like Prettier) — it re-indents around {}, [], () and statement boundaries while leaving strings, template literals, regexes, and comments untouched.

How to format JavaScript

  1. 1

    Paste your JavaScript

    Paste minified or inconsistently formatted JavaScript into the input box.

  2. 2

    Click "Format →"

    The code is re-indented around braces, brackets, and statements.

  3. 3

    Copy the result

    Click "Copy output" to grab the formatted code for your editor or codebase.

Example use cases

1

Reading minified bundle code

Paste in a fragment copied from a production bundle or browser devtools to see its structure clearly.

2

Reviewing a pasted snippet

Quickly re-indent code shared in a chat message or ticket before reading through it.

3

Tidying up before a proper formatter runs

Get code into a roughly readable shape when you don't have Prettier or a build tool set up locally.

Frequently asked questions

What does this formatter do?

It scans your JavaScript token by token — skipping over strings, template literals, comments, and regex literals so their contents are never altered — and re-indents around braces, brackets, parentheses, and statement-ending semicolons.

Is this the same as Prettier or ESLint --fix?

No. This is a lightweight, brace-based indenter, not a full JavaScript parser, so it won't reorganize wrapping, enforce a style guide, or catch syntax errors the way a real AST-based formatter would.

Will it break my strings or regex literals?

It's designed not to — the tokenizer tracks whether it's inside a string, template literal, regex, or comment and passes that text through unchanged.

Is my code uploaded anywhere?

No. Formatting happens locally in your browser using JavaScript — nothing you paste is sent to a server.