Code Beautifier
Paste minified or messy JavaScript or CSS, get it back with clean indentation and one statement per line — or minify it back down.
How it works
The beautifier first tokenizes your code — recognizing strings, comments, numbers, words and operators — then rebuilds it with a consistent style. Indentation follows the nesting depth of braces and brackets: blocks open on the same line (K&R style), each statement ends on its own line, and object properties are split one per line.
Strings and comments are treated as opaque blocks, so their contents are never reformatted. Minify works from the same tokenizer: comments are dropped and whitespace is reduced to the minimum that keeps tokens unambiguous, which is whyreturn x never becomes returnx.
It is syntax-aware but not a full parser — it won’t catch logic errors, and very exotic syntax (nested template literals, regex literals) is formatted best-effort.
Frequently asked questions
Which languages are supported?
JavaScript (including modern syntax like arrow functions, optional chaining and template literals) and CSS (including nested rules and media queries). TypeScript is mostly fine — type annotations are treated as ordinary tokens. For JSON, use the dedicated JSON formatter.
Is minify safe to ship?
It is conservative: it only removes comments and whitespace, never renames variables or rewrites expressions. For the smallest possible output, run the result through a dedicated minifier like Terser, which can also do dead-code elimination.
Why did my one-line array stay on one line?
Arrays and function arguments keep their items on one line; only brace blocks (objects and code blocks) are expanded one item per line. This matches the behaviour of most online beautifiers.
Does it check that my code is valid?
It flags unbalanced braces and brackets, but it does not run a full parser, so it can’t validate syntax the way your browser or a linter would.

