Paste minified or messy JavaScript and JSON, choose your indent and brace style, get clean readable code. Runs entirely in your browser — code never leaves your device.
The JavaScript Beautifier takes minified, obfuscated, or messy JavaScript (or JSON) and reformats it with proper indentation, brace placement, and line breaks. Paste your code, pick your options, click Beautify — the formatted result replaces the input.
It runs entirely in your browser using the open-source js-beautify library. Your code never touches a server — open the network tab while you click Beautify and you'll see nothing go out. This matters when the code is from a private project, a client codebase, or anything you'd rather not paste into an unknown remote service.
The tool only changes whitespace and indentation. It never renames variables, removes logic, or reorders statements — your JavaScript will behave identically after formatting. Pure cosmetic restructuring, nothing else.
Reading a minified file. Production JS is shipped as a single 4,000-character line with one-letter variable names. Beautifying expands the line breaks back so you can follow the logic — variable names stay minified, but at least you can see where one function ends and the next begins.
Inspecting an API response. JSON from an API typically arrives as one long string. Paste, beautify, and the structure becomes immediately readable — useful for debugging unexpected response shapes or documenting what an endpoint returns.
Cleaning up code from a tutorial or AI assistant. Code pasted from chat conversations and tutorials often has inconsistent spacing or mixed indentation. One pass normalises everything to your style.
Enforcing a style before commit. When you're working without Prettier set up locally, this gives you the same clean output for a quick fix.
Paste your code
JavaScript, JSON, or a mix — the tool handles both.
Set your indent and brace style
2-space indent and K&R braces is the modern JS default. Tabs and Allman braces are common in older codebases.
Click Beautify
The formatted code replaces what you pasted, in place. Press Ctrl + Enter for the same result without leaving the keyboard.
Copy and paste into your editor
Click Copy at the top of the editor pane. The formatted code goes to your clipboard.
K&R (same line). Opening brace stays with the control statement: if (x) {. The default in modern JavaScript — used by Airbnb's style guide, Google's, and Prettier's defaults. Pick this unless you have a reason not to.
Allman (own line). Opening brace goes on its own line. Common in C and C# codebases, occasionally seen in older JavaScript. Easier to scan vertically; takes more lines.
End brace on own line. Opening brace stays inline, closing brace goes alone. A middle-ground style some teams adopt.
Keep as-is. Leaves brace placement untouched and formats only the indentation. Useful when you're cleaning up someone else's code and don't want to fight about brace style in the PR.
Will: fix indentation, place braces consistently, add or normalize spacing, wrap long lines, separate chained method calls onto their own lines, collapse multiple blank lines.
Won't: rename variables (so minified a, b, c stays as a, b, c), simplify expressions, remove dead code, rewrite for clarity, or fix syntax errors. If your code doesn't parse, the beautifier will usually try its best but the result may be partially broken — fix syntax errors first.
For full deobfuscation of intentionally scrambled code (renamed variables, packed/encrypted strings), this tool gets you part of the way; you'll still need additional analysis.
Five Indent Sizes
Tabs or 2, 3, 4, or 8 spaces.
Four Brace Styles
K&R, Allman, end-expand, or untouched.
Keyboard Shortcut
Ctrl + Enter beautifies from anywhere.
Runs Locally
Nothing leaves your browser.
JSON Support
Same tool formats JSON responses.
Free Forever
No signup, no limits, no watermark.
js-beautify library. The library is loaded from a CDN once, but your code stays on your machine. You can verify this by opening browser DevTools → Network tab while you click Beautify — no requests leave.a, b, c) back to meaningful names and unpacks intentional encoding tricks. This tool only beautifies — it's a useful first step before manual deobfuscation, but it doesn't rename variables.