Send feedback

Coming from the page: JavaScript Formatter

One moment…

Unminify JSPrettier engineNothing uploaded

JavaScript Formatter

Turn minified or messy JS into clean, readable code.

Everything runs in your browser: your code and files are never uploaded.

How to format JavaScript

1

Paste the code

Paste your JavaScript or open a .js file, or try “Example”.

2

Choose the indent

2 spaces, 4 spaces or Tab, and the line width.

3

Copy or download

Press “Format”, then copy or download the result.

Options

OptionValuesMost common
Indent2 spaces, 4 spaces, Tab2 spaces in most web projects
Line width80, 100 or 120 characters80; longer lines are wrapped

Tips

Find syntax errors. If the code can’t be formatted there’s a syntax error: you get the line, column and reason.

Read a library’s code. .min.js files become readable once formatted, even though variable names stay short.

Your code works the same. Formatting only changes whitespace, line breaks and quotes.

Your code stays private: The tool runs entirely in your browser, so your code and files are never sent to any server, and it keeps working offline once the page is open.

FAQ

How do I unminify JavaScript?

Paste the minified code and press “Format”. Line breaks and indentation come back; shortened names like a and t can’t be turned back into the original names.

Does formatting change how the code works?

No. We tested 13 well-known libraries and test programs: we compared the code tree (AST) before and after formatting and ran the programs to compare their output, and they matched.

Does it support TypeScript?

No, it’s for JavaScript and JSX. TypeScript code will show an error at the first type annotation.

Which engine does it use?

Prettier 3.9 (MIT) with the Babel parser, running in your browser.