lobsite! Sign in Sign up

Free · runs in your browser · no sign-up

JavaScript Formatter

Paste minified or messy JavaScript and get it back indented and readable, with your choice of spaces or tabs. Free, in your browser.

Format your JavaScript

JavaScript minifier →
Formatted

Next Minify it again for production: JavaScript Minifier → Publish your site ↓

How to use the JavaScript formatter

  1. Add your JavaScript

    Paste it, open a .js file, or start from the sample: minified code.

  2. Pick the indentation

    Choose 2 spaces, 4 spaces or tabs. The formatted code appears as you type.

  3. Copy or download it

    Save it as script.js.

What the JavaScript formatter changes

Statements go on their own lines, blocks are indented, and spacing around operators and after keywords is made consistent. The code does exactly the same thing: only whitespace changes. Formatting can't bring back names a minifier shortened, like n and t, or the comments it removed.

When to format JavaScript

  • Reading a minified script to see what it does, or to find where an error comes from.
  • Tidying code from a snippet, an answer or an AI assistant before you edit it.
  • Making two versions comparable before a diff.

JavaScript formatter FAQ

Does it work with modern JavaScript?

Yes: arrow functions, classes, template literals, async/await, optional chaining and modules all format.

Does it check my code for errors?

No. It indents what's there, even if it wouldn't run. The JavaScript Minifier does parse the code, and reports the line and column of a syntax error.

What about TypeScript or JSX?

Most TypeScript formats fine, since it's JavaScript with type annotations. For JSX and large projects, use Prettier in your editor.

Is my code uploaded?

No. Formatting runs in your browser.

Publish your site with its scripts

Drop the folder, or run one command. Free, and live in seconds.

All formatters and minifiers →