JavaScript Beautifier

Paste JavaScript and get it back with consistent indentation and line breaks. The code is only re-spaced as text in your browser: it is never run and never uploaded.

Free, no sign-up. Your code stays in your browser and is never executed.

Your JavaScript

Up to 300,000 characters. Do not paste secrets such as API keys.

Paste JavaScript and press Format.

How to

Format JavaScript in three steps

  1. Paste your code

    Drop in a script, a snippet or a minified bundle.

  2. Choose the layout

    Pick spaces or tabs, where braces go, and an optional line length.

  3. Format, copy or download

    Press Format, then copy the result or save it as a .js file.

Good to know

  • Formatting a minified file makes it readable, but short variable names stay short. The original names are not recoverable.
  • The beautifier does not check your code for errors. Broken code is re-spaced as well as it can be, so a syntax error may not be reported.
  • Your code is treated as text and is never run, so it is safe to paste code you do not trust in order to read it.
  • Do not paste secrets. Nothing is uploaded, but a shared screen or clipboard history can still expose them.

FAQ

JavaScript beautifier questions

Is my code uploaded or run?

Neither. The code is re-spaced as text by a script in your browser. The page makes no network request with it and nothing in it is evaluated.

Can it restore the original names in a minified file?

No. Minifiers shorten variable and function names and that information is gone. The beautifier restores layout (line breaks and indentation), not names or comments.

Does it change what my code does?

It changes only whitespace and line breaks, so behaviour should be the same. It does not add or remove semicolons. Automatic semicolon insertion makes line breaks matter in a few cases, so run your tests after formatting important code.

Does it support modern syntax, TypeScript or JSX?

Modern JavaScript such as classes, arrow functions, template literals and modules is supported. TypeScript and JSX are not specifically supported, so the result for them may not be tidy.

Is there a size limit?

Yes: 300,000 characters. Longer input gets a message and is not formatted.

Can I minify JavaScript here?

No. This site has no JavaScript minifier, because a safe one needs a full parser. Use your build tool for that.