Un-minifying a one-liner
Pasting function add(a,b){return a+b} returns it formatted across multiple lines with proper indentation and a space around the operator, ready to read.
Beautify and format minified JavaScript online for readable code — free JS formatter.
About
Paste minified or inconsistently formatted JavaScript and get it back readable — proper indentation, consistent brace style and normalized spacing — using js-beautify, the same beautify.js engine bundled inside many code editors, without touching your actual logic.
Beautifying restores line breaks and indentation, but it can't fully undo minification: variables a minifier renamed to a, b or c keep those short names, and comments that were stripped are gone for good. For a minified script you need to understand, beautify it first, then use your editor's rename feature to give the important variables meaningful names again.
Examples
4 worked examples
Pasting function add(a,b){return a+b} returns it formatted across multiple lines with proper indentation and a space around the operator, ready to read.
A function with inconsistent spacing and mixed brace styles comes back with consistent indentation (2 spaces by default) and matching brace placement throughout.
A compressed object literal like {a:1,b:2,c:3} is reformatted onto separate lines, one property per line, without changing any of its values.
With Indent size set to 4, function f(){return 1} becomes a three-line function with its return statement indented four spaces.
FAQ
Quick answers to common questions about the JavaScript Beautifier.
Paste your JS code above, make sure JavaScript is selected, then click Beautify. The formatted output appears in the box below it — everything runs in your browser, using js-beautify.
Yes. It's free, with no sign-up and no limit on how much code you format.
Yes — that's one of its most common uses. Paste minified JavaScript in and it comes back with proper line breaks, indentation and spacing restored.
No — it only changes whitespace, indentation and brace placement; the underlying logic and behaviour stay exactly the same.
No. Formatting runs entirely in your browser after js-beautify loads from this site — your code never leaves your device.
Yes — switch the language dropdown, or use the dedicated HTML beautifier or CSS beautifier page.
Yes. Set Indent size anywhere from 1 to 8 spaces before clicking Beautify; the default is 2.
No. Beautifying only adds line breaks and indentation. Names a minifier shortened, like a or b, stay short — the original names can't be recovered without a source map.
It can, since JSON is valid JavaScript, but the JSON Formatter is the better fit: it also checks the JSON is valid and can sort the keys.
Did JavaScript Beautifier work for you?