JavaScript Beautifier

Pretty-print minified JavaScript or JSON: 1–10 space or tab indent, four brace styles, line wrapping, JSX. 100% in your browser, no upload.

More options

🔒 Runs in your browser — nothing is uploaded.

Make minified JavaScript readable again

Paste minified, obfuscated or badly-formatted JavaScript (or JSON) and it comes back cleanly indented with consistent spacing and line breaks. There is no Format button — the result re-renders as you type. It’s powered by js-beautify, the same formatting engine used by many editors, and starts at 2 spaces, K&R braces and one blank line kept between statements.

Match your project’s style

Indent with 1 to 10 spaces or a tab — eleven widths, and a width the tool does not offer is refused rather than quietly formatted at 2. Pick one of four brace styles: same line (K&R), new line (Allman), end expand, or leave as written, which keeps every brace on the line its author put it on. Decide what happens to blank runs: remove every extra newline, allow 1, 2, 3, 4, 5 or 10 between tokens, or keep them all.

Under More options there is a wrap column and seven checkboxes. Blank or 0 never wraps; a real width has to be between 20 and 500, and anything else — 5, 900, 0.5, a word — is refused with a sentence and no output rather than rounded to a width you did not ask for. The checkboxes are: read JSX/e4x markup, comma-first lists, keep array indentation, break chained methods, space before conditional, unescape \xNN in strings, and JSLint-happy spacing.

Nothing leaves your device

Everything runs in your browser — your code is never uploaded, which makes it safe for proprietary or unreleased scripts. Type it, use the Paste button, or open a file from disk (up to 50,000 bytes; a larger file is refused with both its size and the limit named), then copy the result or download it — a file you opened comes back under its own name. With every option left alone the tool changes whitespace and line breaks only, so what your code does is untouched. The one option that rewrites anything more is unescape \xNN, which turns printable escapes inside strings back into the characters they stand for and re-escapes a quote or backslash so the string still holds exactly the same text. This complements the site’s JSON formatter and HTML formatter.

Frequently asked questions

Can it un-minify JavaScript?

Yes — it re-indents minified code so it’s readable, though it can’t restore original variable names that a minifier shortened.

Does it work on JSON too?

Yes. JSON is valid JavaScript syntax, so pasting a minified JSON blob formats it with proper indentation.

Does it change my code’s behavior?

No. With every option at its default it changes whitespace and line breaks only, and the logic is untouched. One optional checkbox rewrites more than layout — the unescape option, which turns printable hex escapes inside a string back into the characters they stand for and re-escapes a quote or backslash so the string still holds exactly the same text.

Is my code uploaded?

No. Formatting happens entirely in your browser, so proprietary scripts never leave your device.

How many indent widths can I choose?

Eleven: 1, 2, 3, 4, 5, 6, 7, 8, 9 or 10 spaces, or a tab. The default is 2 spaces, and a width the tool does not offer is refused rather than silently formatted at 2.

Which brace styles are available?

Four: same line (K&R), new line (Allman), end expand, and “leave as written”, which keeps each brace on the line the author put it on instead of moving it.

Can I control the blank lines between statements?

Yes, with eight settings: remove every extra newline, allow 1, 2, 3, 4, 5 or 10 newlines between tokens, or unlimited. The default allows 2, which keeps one blank line.

Can it wrap long lines?

Yes. Set a wrap column under More options: blank or 0 never wraps, and a real width has to be between 20 and 500. A value outside that range, or one that is not a whole number, is refused with a message and no output — nothing is ever wrapped at a width you did not choose.

Does it handle JSX?

Yes, with the “Read JSX / e4x markup” checkbox under More options. Without it, markup like <div className="a">{y}</div> is read as a chain of comparisons rather than as JSX.

Can it unpack or deobfuscate a packed script?

It re-indents obfuscated code so you can read it, but it will not run the script. js-beautify implements packer detection by evaluating the pasted code, and this page will not execute a stranger’s script in your tab. It also cannot restore variable names a minifier shortened.

Can I open a file instead of pasting?

Yes — the Open file button takes .js, .mjs, .cjs, .jsx, .ts, .tsx and .json up to 50,000 bytes, and a bigger file is refused with both its size and the limit named. The formatted copy downloads under the same file name. The engine is js-beautify’s JavaScript beautifier, so TypeScript-only syntax is formatted as JavaScript rather than parsed as TypeScript.

How much code can it format at once?

Up to 50,000 characters of input; past that it says so instead of freezing the tab. A result over 1,000,000 characters — which unbalanced brackets can produce — is withheld with the same message.