convertCASEpro

MODE

JavaScript Formatter

Make minified or messy JavaScript readable.

INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0

How the JavaScript Formatter works

The code is parsed and printed again using Prettier's rules: consistent indentation, line breaks at a sensible width, spacing around operators and tidy chained calls. JSX and modern syntax such as optional chaining and async functions are supported.

Choose two or four spaces or tabs, single or double quotes, and whether to add semicolons. If the code has a syntax error, the message shows the line and column so you can find it quickly.

When it is useful

  • •Reading a minified script copied from a production site.
  • •Normalizing a code snippet before sharing it in an issue or answer.
  • •Quickly checking whether a snippet parses.
  • •Applying a consistent style to a one-off script without setting up a project.

Frequently Asked Questions

Can it restore variable names in minified code?

No. Formatting restores layout only. Names shortened by a minifier cannot be recovered.

Does it support TypeScript?

Use the TypeScript Formatter, which understands types, interfaces and generics.

Does the code leave my browser?

No. Formatting runs locally using a JavaScript build of the formatter.

Related tools

[ Browse all tools ]