100% offline
Developer
Free · no signup
Updated

JavaScript Formatter

A JavaScript Formatter reprints minified or inconsistent JavaScript into readable, canonically formatted code using Prettier's engine in your browser — with JSX, TypeScript, and TSX supported by the same tool.

JavaScript input0 lines · 0 B
Formatted0 lines · 0 B
(formatted output appears here)

About JavaScript Formatter

Paste minified JavaScript and get back properly indented code with consistent quotes, semicolons, and line breaks. Unlike simple beautifiers that only re-indent text, Prettier parses the code and reprints it from the syntax tree, so the result is canonical rather than a best guess — and because the parser has to succeed first, a syntax error is reported with an exact line and column instead of being silently passed through. TypeScript and TSX use the TypeScript parser, so types, generics, and decorators survive intact. The engine is bundled with the page, so nothing you paste is uploaded.

What JavaScript Formatter does

  • JavaScript, JSX, TypeScript, and TSX in one tool
  • Reprints from the syntax tree — canonical, not re-indented text
  • Semicolons, quote style, trailing commas, arrow parens
  • Exact line and column on a syntax error
  • Runs the real Prettier engine, self-hosted — no CDN
  • Copy or download the formatted source

When to reach for JavaScript Formatter

  • Reading a minified bundle you're debugging
  • Cleaning up a snippet copied from a gist or answer
  • Normalising code style before a review
  • Formatting TypeScript on a machine without an editor set up

How to use JavaScript Formatter

  1. 01

    Paste your code

    Paste JavaScript, JSX, TypeScript, or TSX into the input pane.

  2. 02

    Set your style

    Choose indentation, quotes, semicolons, and wrap column.

  3. 03

    Copy or download

    Copy the formatted code or download it as a file.

When to use JavaScript Formatter vs alternatives

AlternativeUse JavaScript Formatter when…Use the alternative when…
A basic JS beautifieryou want Prettier's canonical output plus real TypeScript and JSX support.you need to beautify code that doesn't parse — a lenient beautifier will still indent it.
Running Prettier in your editorthe snippet isn't in a project, or you can't install anything on this machine.you're formatting files in a repo you already have open.

Frequently asked questions

Can this unminify JavaScript?
It restores formatting, not information. Indentation, line breaks, and spacing come back, but names that a minifier shortened to a and b stay short, and stripped comments are gone — that data no longer exists in the file.
Does it handle TypeScript and JSX?
Yes. Pick JavaScript, JSX, TypeScript, or TSX in the toolbar. TypeScript and TSX use Prettier's TypeScript parser, so type annotations, generics, enums, and decorators are preserved.
Why won't it format my broken code?
Prettier must parse the code into a syntax tree before it can print it, so a genuine syntax error stops the process. The error tells you the exact line and column — more useful than a beautifier that indents broken code and hides the problem.
Is my code sent to a server?
No. Prettier is bundled with this page and runs entirely in your browser, so pasting proprietary or client code is safe. Open DevTools and you'll see no request carrying your source.