JS Beautifier

Paste minified or messy JavaScript and get clean, readable code back. The formatter tokenizes your code — handling strings, template literals, comments and regular expressions carefully — then re-indents it with 2-space indentation.

Your result will appear here

Formatted JavaScript

Original lines
—
Formatted lines—

Formatting only changes whitespace — it never renames variables or changes what the code does.

How to use

  1. Paste your minified or unformatted JavaScript into the box.
  2. Click Beautify JS to re-indent it with line breaks and 2-space indentation.
  3. Copy the formatted code or download it as a .js file.

Frequently asked questions

What is a JS beautifier?

It takes JavaScript that has been squashed onto one line — minified code — and rewrites it with line breaks and indentation so a human can read it. The logic of the code is not changed.

Does beautifying change what my code does?

No. Only whitespace is added or removed. Strings, comments and regular expressions are preserved exactly, so the code runs the same as before.

Can it format code with template literals?

Yes. The tokenizer understands backtick template literals, including ${ } expressions inside them, as well as single- and double-quoted strings.

Is my code uploaded anywhere?

No. Formatting happens entirely in your browser. Your code never leaves your device.

Related tools