A one-line wall of code
You copied a minified snippet from a bundle or a console and need to read it — find a missing brace, check a condition, or just understand the flow. Opening it in an editor and re-saving is friction you do not need for a quick look.
Tidy it locally
Paste into the JavaScript Beautifier. It re-indents based on braces and semicolons so the structure becomes scannable. Strings and comments are preserved; nothing leaves your browser.
Worked example
function f(a){if(a){return a*2}else{return 0}} becomes a properly indented function you can read line by line in under a second.
Boundaries
- This is a lightweight, dependency-free indenter for quick cleanup — not a full formatter.
- For production (ASI, ASF, JSX), run Prettier in your pipeline; this tool is for fast in-browser tidying.
- Severely malformed input (unbalanced quotes) may not indent perfectly.
FAQ
Does it change my code's behavior? No — only whitespace; logic is untouched.
Can it handle JSX/TypeScript? It tolerates them loosely but is not a TS/JSX formatter; use your build toolchain for those.