JavaScript Formatter

Beautify minified or messy JavaScript code instantly.

What is the JavaScript Formatter?

This tool reformats JavaScript code — minified for production, copied from DevTools, or just inconsistently indented — into clean, readable code with consistent spacing, line breaks and indentation.

How to use it

  1. Paste your JavaScript into the input box.
  2. Choose an indent size and click Format Code.
  3. Copy the beautified result.

Minified JavaScript strips out whitespace and shortens variable names to reduce file size for production, which makes it essentially unreadable to a human. This formatter reverses the whitespace side of that process (it does not rename minified variables back), which is enough to make control flow, function boundaries and nested blocks visible again — useful for understanding a bundled script, debugging in the browser, or reviewing a code snippet someone sent you without the original formatting. It's powered by the same battle-tested js-beautify library used by many code editors and IDEs.