JavaScript beautifier

Turn minified or compressed JavaScript into readable code with proper indentation and spacing, ready to read, debug or review.

Free and private. Everything runs in your browser, nothing is uploaded.

How it works

  1. Paste your JSPaste the code, type it or open a file. Try Sample to see an example.
  2. Check the resultThe result appears on the right as you type. Errors are shown with the line and column.
  3. Copy or downloadCopy the JS with one click or download it as a file.

Safe for real code

The beautifier reads your code the way a JavaScript engine does: strings, template literals with expressions inside, regular expressions and comments are recognized, so their contents are never changed.

Existing line breaks are respected, because in JavaScript a line break can end a statement. The result runs exactly like the original.

Choose 2 spaces, 4 spaces or tabs, and the beautifier also formats code that has no semicolons at all.

About JS

JavaScript is the language of web pages and many tools. The formatter understands strings, template literals, regular expressions and comments, so it never breaks code by touching their contents.

Frequently asked questions

Does it support modern JavaScript?

Yes. Arrow functions, classes with private fields, async functions, generators, optional chaining, spread and modules are all handled.

Is my code uploaded anywhere?

No. Formatting and minifying run in your browser. Your code is not sent to our servers.

Does minifying rename my variables?

No. Minifying removes comments, line breaks and spaces only. Names stay readable and the code behaves exactly the same, which makes it safe for any file.

Why are some line breaks kept in minified JavaScript?

JavaScript treats some line breaks as the end of a statement. Where removing one could change what the code does, it is kept.

Can I format JSON here?

JSON has its own tool with a tree view and validation. Use the JSON Tools page linked below.

Does it work offline?

Yes. After you open the page once, it keeps working without an internet connection.