Skip to main content

Code Beautifier

Paste minified or badly formatted code and get something readable back.

Beautified code
Your result will appear here

Formatted entirely in your browser — your code is never uploaded.

About this tool

The code beautifier turns minified or badly formatted source back into something readable. It handles JavaScript, CSS, HTML, JSON, XML and SQL, and detects which one you pasted.

The most common use is reading a file that has already been minified — a .js or .css bundle collapsed onto one line — or code copied out of an email or chat that arrived with all its indentation stripped.

What matters here is that it uses a real parser rather than counting braces. Code like const a = "}" or /[{}]/ contains braces inside literals, and a regex-based indenter miscounts them and wrecks the indentation for the rest of the file.

JSON mode works by parsing and re-serialising, so it validates as it formats: a trailing comma or an unquoted key is reported rather than prettified into a file that still cannot be parsed. Everything runs in your browser, and your code is never uploaded.

How to use

  1. 1Paste minified or badly formatted code into the input box
  2. 2The language is detected automatically, or pick it from the list
  3. 3Set the indent width your team uses
  4. 4Copy or download the formatted code

Frequently asked questions

Which languages are supported?
JavaScript, CSS, HTML, JSON, XML and SQL. Each goes through a formatter that actually understands that language, rather than guessing from curly braces.
Could it break my code?
Beautifying only changes whitespace and line breaks, never meaning. And because it uses a real parser, a brace inside a string or a regular expression does not throw the indentation off.
How is this different from hitting format in my editor?
The result is similar, but this works instantly in a browser — useful for reading code from elsewhere, like inspecting another site's minified bundle, or on a machine with no editor set up.
Why does the JSON mode report an error?
JSON mode validates as it formats. Comments, trailing commas or unquoted keys are not valid JSON, so it says so instead of prettifying a file nothing can parse. Pick JavaScript if you only want the indentation fixed.
Is my code sent to a server?
No. All formatting happens in your browser; your code never leaves the page.

Related tools

Code Minifier

Shrink JavaScript, CSS, HTML and JSON files.

JSON Formatter

Format, validate and minify JSON — for developers.

SQL Formatter

Turn a long SQL statement into something readable.

XML Formatter

Indent XML and check the structure is valid.