Search tools

JavaScript Beautifier

Unminify JavaScript so you can read it — consistent indentation, one statement per line.

JavaScript Beautifier tool

Options

Processing runs in your browser.

Minified JavaScript runs fine but is unreadable: a whole library on one line. When you need to understand what a third-party script does, track down a bug in a production bundle, or review a snippet someone sent you, a beautifier lays the code out properly.

Uses

  • Security and privacy reviews of tracking or vendor scripts.
  • Debugging production code when source maps aren’t available.
  • Learning from how other sites implement features.
  • Tidying code copied from chats or old documentation.

Reading unfamiliar code faster

After formatting, search for network calls such as fetch or XMLHttpRequest, look for event listeners, and scan string literals: URLs, error messages and feature names often explain what a minified script does long before the variable names do.

How to use the JavaScript Beautifier

  1. Paste JavaScript (or JSON) or open a .js file.
  2. Choose indentation and an optional maximum line width.
  3. Copy the formatted code or download it.

Features

  • Restores line breaks and indentation for minified code.
  • Handles modern syntax: arrow functions, classes, template literals and async/await.
  • Optional line wrapping for very long expressions.
  • Also formats JSON and JSON-like objects.

Frequently asked questions

Can it restore the original variable names?

No. If the code was minified with name mangling, short names like a and b are all that’s left. Formatting makes the structure readable, which is usually enough to follow the logic.

Is it the same as Prettier?

It’s a similar idea with fewer opinions. It uses js-beautify, which focuses on making any input readable rather than enforcing one strict style. For your own projects, a project-wide formatter is best.

Is it safe to paste third-party scripts?

Yes. The code is formatted as text and never executed or uploaded.

Written by