Skip to main content

JavaScript Beautifier

Reformat minified or messy JavaScript into readable code with your choice of indent size, semicolons and quote style.

For developers reading compressed or inconsistent source.

Last updatedHow we build & check our tools
Results will appear here once you enter your values.

Why format code you did not write

Minified bundles put thousands of statements on a single line, which makes diffs, stack traces and quick reading painful. A formatter gives each statement its own line and indents blocks so you can follow the control flow. Pasting a snippet from a bug report, a CDN file or a browser's network tab and formatting it is often the first step in understanding it.

Try the default: function a(b){return b+1} becomes a three-line function with the return statement indented two spaces, ending in a semicolon, with strings in single quotes.

  • Indent size: 2 matches most front-end style guides; 4 is common in other ecosystems.
  • Semicolons: turn off for no-semicolon style; the formatter adds protective semicolons only where the grammar requires them.
  • Quotes: single or double, applied to string literals.

Limits

The Babel parser handles modern JavaScript and JSX syntax.

It does not format TypeScript, HTML, CSS or JSON; use a tool for that language.

Obfuscated code stays obfuscated after formatting.

Very large files may be slow, and input over 1,000,000 characters is rejected.

Sources

Prettier documentation, Browser and Options pages (prettier.io/docs/browser and /docs/options) describe the standalone build and the tabWidth, semi and singleQuote options. JavaScript syntax follows ECMA-262, the ECMAScript language specification maintained by TC39.

Next steps: shrink the result again with the JavaScript Minifier, or format JSON with the JSON Formatter and markup with the HTML Formatter.

Frequently Asked Questions

Common questions about the JavaScript Beautifier

It uses Prettier 3.9.10 in its standalone browser build, with the Babel parser and the estree printer plugin. Those files are bundled with the site and load in your browser the first time you press Format; your code is not sent to a server. If the files cannot load, the tool shows a message asking you to check your connection.

From the same team

Turn your GPU into an OpenAI-compatible API endpoint

Wide Area AI routes your LLM API calls to your own hardware over a Cloudflare Tunnel — free local inference with edge caching and automatic cloud failover. Works with any OpenAI SDK.

Start routing — free

Sources & References

Web platform and protocol references

Authoritative definitions for web technologies, encodings, and data formats used by these developer tools.

Internet standards (RFCs)

Formal specifications for internet formats and protocols.