HTML Formatter
Beautify and indent HTML markup.
OpenMake compressed JavaScript readable enough to trace, with strings and comments left alone.
Paste bundled or minified JavaScript, or drop a .js file.
Braces open indented blocks and each statement gets its own line.
Use Minify to strip comments and spacing from the same input.
Copy it or download it as formatted.js.
A production error points to line 1, column 48210 of a bundled script, and you want to see what the surrounding code is doing. A quick beautify pass breaks that wall of text into blocks you can actually follow, without installing a build tool.
This is a lightweight, heuristic beautifier rather than a full parser like Prettier. It adds a line break and two spaces of indent after every opening brace, puts closing braces on their own lines, and starts a new line after each semicolon. Single-quoted, double-quoted and backtick strings are copied verbatim, as are // and /* */ comments, so URLs and SQL inside strings keep their spacing. It formats live as you type, accepts a dropped .js file, and a Minify button collapses whitespace back down.
Because it reacts to every semicolon, a loop header like for (let i = 0; i < n; i++) gets split across lines, and regular expression literals that contain quote characters can confuse the string detection. It is great for reading code, less so for committing it. To spot what changed between two builds, paste both formatted copies into the Diff Checker. For shipping, use the JavaScript minifier, and for API payloads the JSON Formatter is a better fit because it actually parses the data.
Your script is processed as text by code already loaded in the page. It is never evaluated or executed, and it is not uploaded.
Keyboard shortcut
Answers for this tool. For site-wide help, open the FAQ hub.
No. Minifiers rename variables to single letters and that information is gone. The formatter restores layout only; a source map is the only way to recover original names.
For layout, mostly. It only reacts to braces, semicolons, strings and comments, so type annotations and JSX pass through as text. JSX markup will not be indented the way an HTML formatter would do it.
The beautifier starts a new line after every semicolon, including the two inside a for statement header. Join them back by hand if you plan to keep the code.