JavaScript Formatter
Structural indentation that respects strings and comments
Everything runs in your browser. Your data never leaves your device.
Related tools
How to use
This applies structural indentation rather than a full reformat. It tracks depth and skips over strings and comments, which is enough to make minified code readable without shipping a full parser to your browser.
Paste your code
Minified bundles, a copied console snippet or hand-written code all work. Input does not need to be syntactically complete.
Choose the indentation
Two spaces, four spaces or tabs, applied at every brace and bracket level.
Check for unbalanced structure
If braces or brackets do not balance, the tool reports it. On a truncated paste this usually means you copied only part of the code.
Examples
Reading minified code
A minified function with a nested filter callback expands so the callback body sits one level in and each statement gets its own line — enough to follow the logic and find the condition you were looking for.
Strings are left alone
A string containing a brace, such as const t = "{ not code }", is skipped entirely during depth tracking, so it never causes the rest of the file to indent incorrectly.
About this tool
Indent JavaScript by brace and bracket depth to make minified or badly formatted code readable. String literals, template literals and comments are skipped during analysis, so a brace inside a string never shifts the indent level. Useful for making bundled or obfuscated code legible enough to reason about.