What it's for
Turns minified code (everything on one line, no spaces) or badly indented code into a readable format with 2-space indentation — useful for understanding someone else's code, debugging something copied from elsewhere, or reviewing a snippet before using it.
How it works
Uses the open-source, widely tested js-beautify library instead of a homemade implementation — avoiding subtle formatting bugs. Nothing is sent to a server: everything runs in your browser.
Formats only — no minifying
This tool only goes "messy → readable". Safely minifying JavaScript (without breaking the code) requires a full syntax parser — that's not offered here to avoid the risk of producing broken JS; for that, we recommend a build tool like Terser or esbuild.
When the output surprises you
A snippet like if(a){b()}else{c()} gets braces on their own lines and 2-space indentation. If the code has a syntax error, such as an unclosed brace, the formatter will not repair it: the indentation will drift from the point of the error onward, which actually helps locate it.
Pick the right language in the selector, since JSON, CSS and HTML follow different line-breaking rules. Minified bundles with thousands of statements format fine, but expect a very long result.
Frequently asked questions
Does this tool also minify code?
No — it only formats (makes it readable). Safely minifying JS requires a full parser, which we chose not to reimplement here to avoid risking broken code.
Is my code sent to any server?
No — formatting happens entirely in your browser.
Can I format CSS and HTML as well as JavaScript?
Yes, use the language selector to choose among the offered options. The CSS formatter puts each property on its own line, and the HTML one indents nested tags. A very large file works but can take a moment to render.