Home › Developer Tools › JavaScript Formatter
JS

Free Online JavaScript Formatter

Turn minified or messy JavaScript into clean, readable code.

Your data stays on your device. This tool processes everything directly in your browser. Nothing you enter is sent to our servers.

Tip: Ctrl + Enter to format · Ctrl + K to clear

Output
Formatted code will appear here.

How it works

  1. Paste minified or messy JavaScript.
  2. Choose indentation and brace style.
  3. Click Format (or press Ctrl + Enter).
  4. Copy the readable code or download it as a .js file.

Frequently asked questions

Can this reverse minified JavaScript?

It restores indentation and line breaks so minified code becomes readable again. Variable names shortened by a minifier (like a, b, c) cannot be recovered, because the original names are no longer in the file.

Does formatting change how my code runs?

No. Only whitespace and line breaks change. The formatter understands modern syntax such as arrow functions, template literals, classes and async/await.

Which formatter engine is used?

The tool uses js-beautify, a widely used open-source formatter, running entirely in your browser. It is loaded only on this page.

Is my code uploaded?

No. Your code never leaves your browser, so it is safe to format proprietary or unreleased source code.

Readable JavaScript from minified code

Minified bundles, inline scripts and code copied from browser dev tools are hard to follow. The JavaScript formatter restores indentation, line breaks and spacing so you can read, debug and review the code.

Formatting options

  • Indentation — 2 spaces, 4 spaces or tabs to match your project.
  • Brace style — keep opening braces on the same line, or move them to a new line.
  • Keep blank lines — preserve intentional spacing between blocks.
  • Break chained methods — put each .then() or .map() call on its own line.

What formatting cannot do

A formatter only changes whitespace. Minifiers often rename variables to single letters; those original names cannot be recovered. For full debugging of production bundles, use the source maps generated by your build tool.

Also works for JSON-like code

Object literals and configuration files written in JavaScript format nicely too. For strict JSON with validation, use the JSON Formatter.

Keyboard shortcuts

/
Search all tools
?
Show this help
Esc
Close search or dialogs
Ctrl + Enter
Run the tool's main action (Format, Generate, Calculate…)
Ctrl + K
Clear the tool's input

Tool shortcuts work while you're using a tool, including inside its text boxes.