JavaScript Formatter

Make minified or one-line JavaScript readable again, with consistent indentation and line breaks.

✓ Runs locally in your browser — nothing is uploaded

In short: A JavaScript formatter (beautifier) re-indents code and adds line breaks so minified or badly formatted scripts become readable again; it does not change behavior.

About JavaScript Formatter

Production JavaScript is usually minified: every variable shortened and the whole file on one line. When you need to understand what a third-party script does, debug a bundle without source maps or tidy up a snippet from Stack Overflow, beautifying restores line breaks and indentation.

The formatter is powered by js-beautify. It only changes whitespace and line breaks, so the code behaves exactly the same. It cannot restore original variable names that a minifier removed.

How to use JavaScript Formatter

  1. Paste your JavaScript.
  2. Choose indent size and brace style.
  3. Press Beautify and copy the result.

Examples

Minified function

function f(a){if(a){return 1}return 2} is expanded to six indented lines.

Arrow functions

Modern syntax such as arrow functions, template literals, classes and optional chaining is supported.

Frequently asked questions

Can it minify JavaScript too?

Not on this page. Safe JavaScript minification needs a full parser such as Terser, which is best run in your build process.

Does it work with TypeScript or JSX?

Mostly yes for TypeScript; type annotations are kept. JSX is formatted as JavaScript and may not be indented as neatly as with Prettier.

Can it deobfuscate code?

It makes code readable but does not undo deliberate obfuscation such as string encoding.

Is my code uploaded?

No. Formatting runs in your browser. You can check this yourself: open your browser’s developer tools, switch to the Network tab and use the tool — no request carries your input.

Updated November 2026 · Free, no signup · How we build and test tools

Related tools All developer tools →