My Tool Studio
Developer

JS Beautifier

A stack trace points at column 48,000 of a vendor file and you need to see what's actually there. This js beautifier expands minified code back into readable form: paste the source, click Beautify, and js-beautify re-indents it at two spaces per level with sensible line breaks. It's the quickest way to unminify javascript when you're debugging a third-party script, auditing a tag manager snippet, or just curious what a library does under the hood. Variable names stay as the minifier left them, but structure, nesting, and control flow become plain to read. Everything runs locally in your browser.

Always freeNo sign upRuns in your browser
Output appears here...

How to use

01

Paste the minified code

Drop the script into the Input pane. The Try sample button loads a squashed one-liner so you can see the expansion instantly.

02

Click Beautify

The code re-flows with two-space indentation, one statement per line, and braces where you expect them. Logic and behavior are untouched.

03

Read or copy the result

Study the structure right in the Output pane, or use Copy to move the formatted source into your editor for a proper investigation.

Why JS Beautifier

Common questions

Can beautifying recover the original variable names?
No, that information is destroyed during mangling. What you get back is layout: indentation, line breaks, and visible block structure. For real names you need the source map or the original repository. Even so, readable structure plus string literals is usually enough to follow the logic.
Is this js beautifier the same as a javascript formatter online like Prettier?
Close cousins. Prettier enforces a whole style across a project; this javascript formatter online applies clean default formatting to whatever you paste, with zero setup. Use your editor's formatter for code you maintain, and this page for code that just landed in front of you.
Why beautify a script before debugging it?
Breakpoints and stack traces are nearly useless on a one-line file. Once expanded, line numbers become meaningful, you can skim for the function that threw, and diffing two versions of a vendor script becomes possible. Browsers offer pretty-print in devtools, and this page does the same job when you want the code outside the debugger.
Does it execute or lint the JavaScript?
Neither. The tool rewrites whitespace and line structure only, so nothing runs and no warnings appear. That also means it's safe to paste code you don't trust yet; reading it here is exactly as inert as reading it in a text file.
What's the fastest way to format js code online?
Paste, click Beautify, copy. No account, no config file, no project setup. When you need to format js code online in the middle of an incident, the two panes here are quicker than opening an IDE.
Where should JSON be formatted instead of a js beautifier?
The JSON Formatter is the better fit: it validates syntax while formatting, catches trailing commas, and understands the stricter grammar. This page treats JSON as JavaScript, which mostly works but won't warn you when the payload is invalid.

More Developer tools

View all