JavaScript Formatter
Paste JavaScript, JSX or modern ES syntax and get it formatted the way Prettier would in your editor. Toggle single quotes and semicolons.
Formatted
Paste code to format it.
About this tool
Reading minified JavaScript from a production bundle, a bookmarklet or a library snippet is nearly impossible without formatting. Prettier parses the code with Babel, so it understands the latest syntax — optional chaining, async iteration, class fields, JSX — and prints it with consistent line breaks and indentation. The output is semantically identical to the input.
Options mirror the most common Prettier settings: indent width, tabs, line width, single or double quotes and semicolons. The formatter loads on first use and runs entirely in your browser, so private code stays on your machine.
Frequently asked questions
- Why does it say syntax error?
- The code must parse. Minified code that was truncated when copying is the usual cause; make sure you copied the whole file.
- Does it deobfuscate code?
- It restores formatting, not variable names. Mangled names like a, b, c stay as they are.
- Can I format TypeScript?
- Plain JavaScript and JSX only. TypeScript type annotations will produce a syntax error.