Developer 🔒 Runs in your browser — no data sent to servers

JavaScript Beautifier

Turn minified or badly formatted JavaScript into code you can actually read.

Input
Output

Beautify JavaScript Online

Reading a production bundle, a third-party widget or a snippet someone squeezed onto one line is much easier once it is indented. This page is the Code Formatter set to JavaScript formatting, using the open-source js-beautify library in your browser.

What changes

  • Each statement goes on its own line.
  • Blocks inside braces are indented by nesting level.
  • Spaces are added around operators and after commas.
  • Blank lines you kept are preserved, up to two in a row.

Reading minified code

Beautified output from a minified file still has one-letter names, so read it by structure: find the exported functions, follow the calls, and rename things mentally as you understand them. If the original project publishes source maps, the browser's developer tools can show the original source instead, which is always better than reading minified code.

Related tools

To go the other way, use the JavaScript minifier. To see what changed between two versions of a script, format both here and compare them with Text Compare.