JavaScript Beautifier

JavaScript Beautifier reformats minified, generated or untidy code into clean, properly indented JavaScript that is easy to read and review. Choose 2- or 4-space indentation to match your style.

It is the tool to reach for when you need to understand a minified bundle, inspect a snippet copied without formatting, or tidy code before committing it. Formatting runs entirely in your browser.

How to use JavaScript Beautifier

  1. 1

    Paste your JavaScript

    Drop in minified or messy code.

  2. 2

    Pick an indent size

    Switch between 2 and 4 spaces of indentation.

  3. 3

    Copy the formatted code

    Grab the clean, indented output with the copy button.

Make minified code readable

Minified JavaScript collapses everything onto as few lines as possible, which is great for production but painful to debug. Beautifying restores the line breaks and indentation that reveal the structure of functions, loops and conditionals.

The beautifier reformats layout only. It can restore the shape of the code, but variable names that were shortened during minification stay short, because that information is permanently discarded when code is minified.

A companion to the minifier

Use the beautifier to inspect or edit a script, then run it through the JavaScript Minifier before shipping. Together they let you move between a readable and a compact form of the same code.

Because beautifying changes only whitespace, it never alters what your code does.

Frequently asked questions

Can it recover original variable names?
No. Beautifying restores indentation and spacing, but names shortened during minification cannot be recovered because that information is discarded.
Does beautifying change behaviour?
No. It only adds whitespace, which does not affect how the code runs.
Is my code sent to a server?
No. Formatting runs entirely in your browser.

Last updated: