Format HTML, CSS and JavaScript with proper indentation — language detected automatically.
Formatted locally — your source never leaves your browser.
Can you unminify JavaScript back to the original code?
Only partly. Beautifying restores indentation and line breaks so the code is readable again, but a minifier permanently discards comments and shortens variable names, so those never come back. The result is good for reading and debugging, but it is not the original source.
Understanding your result
It is worth being clear about what unminifying can and cannot recover. Whitespace and line breaks come back exactly, so the structure becomes readable again. What does not come back is anything the minifier discarded: original variable names shortened to single letters stay short, comments are gone, and any inlining or dead-code elimination has already changed the shape of the code. That is fine for reading and debugging, but the result should never be treated as the original source or committed as though it were.
Formula and method
The formatter parses the code into a token stream, tracks nesting depth through brackets, braces and tags, and re-emits each token with indentation matching its depth. Only whitespace changes; no statement is rewritten.
Assumptions and limitations
Beautifying is not the reverse of minifying: shortened variable names, removed comments and inlined functions are gone for good, so unminified output is readable but not the original source. Language detection is heuristic and can be wrong on ambiguous snippets like CSS-in-JS — set the language manually in that case. The formatter also assumes valid syntax; unclosed brackets or quotes will produce odd indentation rather than an error.
Worked example
A single-line minified function with a nested array of objects and a forEach call expands to roughly a dozen properly indented lines, with each brace level shifted by your chosen indent.
How to use this tool
- Paste your code.
- Leave the language on automatic, or pick it if the snippet is ambiguous.
- Choose your indent width and whether to use tabs.
- Copy the formatted code or download it.
Common mistakes to avoid
- Expecting beautifying to restore original variable names and comments.
- Leaving detection on automatic for a CSS-in-JS or templating snippet.
- Formatting code with unclosed brackets and blaming the odd output.
- Committing unminified vendor code instead of the real source.
About the Code Beautifier
The Code Beautifier re-indents HTML, CSS and JavaScript into readable form — useful for unminifying compressed files or tidying code that has lost its formatting. It detects the language from the content, and you can choose spaces or tabs and the indent width.
Who should use this tool
Developers reading minified files, students studying source code and anyone tidying a snippet before sharing it.
Benefits
- Three languages in one tool, with automatic detection.
- Unminifies compressed production files into readable code.
- Spaces or tabs, at your chosen width.
- Proprietary source never leaves your machine.
Practical use cases
- Reading a minified JavaScript or CSS file.
- Tidying a snippet before pasting it into a pull request or an answer.
- Reformatting inherited code to match your indentation style.
- Making generated HTML readable for debugging.
Explore all Developer Tools tools
Frequently asked questions
Can this unminify a JavaScript file?
Yes — it restores indentation and line breaks so the code is readable. It cannot restore original variable names or comments, because the minifier removed them permanently.
Does formatting change how the code behaves?
No. Only whitespace changes. The parsed program is identical, so behaviour is unchanged.
How does automatic detection work?
It looks at how the snippet starts and which constructs appear — angle brackets suggest HTML, selector-and-brace patterns suggest CSS, and function or arrow syntax suggests JavaScript.
Is my code uploaded?
No. The formatter is bundled with the page and runs in your browser, so proprietary source stays on your machine.
Tabs or spaces?
Whichever your project already uses — consistency matters far more than the choice. Tabs let each developer set their own visual width; spaces render identically everywhere.