JavaScript Formatter & Beautifier

Paste JavaScript or JSX to format it with Prettier. Set tab width, print width, semicolons and quote style to match your project.

Loading tool…

About the JavaScript Formatter

The formatter is Prettier 3 with the Babel parser, the same engine behind the Prettier extensions for VS Code and WebStorm. It understands modern ECMAScript — optional chaining, async/await, classes with private fields, top-level await, ES modules — and JSX, so React components format correctly. The output is identical to running npx prettier with the same options.

Options map to .prettierrc settings: tabWidth, useTabs, printWidth, semi and singleQuote. With semicolons off, Prettier inserts a leading ; where a line starting with (, [ or a template literal would otherwise join the previous statement — the same ASI protection it applies in real projects. Print width is a target, not a hard limit: long strings and URLs are never split.

Prettier reformats layout only; it will not rename variables, remove dead code or fix bugs. If the code does not parse, you get the first syntax error with its line and column — a quick way to find a missing bracket. To make minified bundles readable, paste them here; for production size reduction use the JavaScript Minifier. Your code is processed locally and never uploaded.

How to use it

  1. Paste JavaScript or JSX.
  2. Adjust tab width, print width, semicolons and quotes.
  3. Wait for the first load of the formatter (a few hundred KB).
  4. Copy or download the formatted file.

Frequently asked questions

Does this match running Prettier locally?
Yes, for the same Prettier version and options. Note that a project .prettierrc or .editorconfig may set options you need to mirror here.
Can it beautify minified code?
Yes, it restores line breaks and indentation. Variable names shortened by a minifier stay short; no tool can recover the originals without a source map.
Why are my semicolons still there after unticking Semicolons?
Prettier keeps semicolons that are required for correctness, for example before a line starting with [ or (, and in for (;;) loops.

Related tools