Format JavaScript

You've stumbled onto a minified JavaScript bundle (everything on one or two lines) and want to understand what it does before pasting it somewhere or studying it? Paste it here to get an indented version based on { } blocks, making it easier to read.

Example:
Basic formatter (indentation based on braces): it doesn't rename variables and doesn't replace Prettier.

How it works

Paste your minified or compact JavaScript into the field above and click "Format": the tool tracks the depth of { } braces to indent by 2 spaces per level (an if, for, function block, etc. increases the indentation), and also tracks nested parentheses so it doesn't split a for (;;) statement because of internal semicolons. Strings, template literals, and comments are respected thanks to a small state machine, similar to the site's minifier. As mentioned above, this is a basic formatter, not a full replacement for Prettier.

Can the reformatted code stop working?

No: only the presentation (spaces, line breaks, indentation) is changed, never the logical structure of the code. If the result looks poorly indented on very unusual syntax, the code nonetheless remains functionally identical to the original.

Can the original variable names be recovered?

No, this formatter only reindents the code : variable names shortened by a minification tool (for example a, b, t) remain as they are. Only an advanced "deobfuscation" tool could try to guess more explicit names, which this formatter does not do.

Formatting runs 100% locally in your browser via WebAssembly : your JavaScript code is never sent to a server.