Skip to main content

JavaScript Beautifier

Format JavaScript, TypeScript and JSX with your choice of indent, quotes, semicolons and line width. Private, runs in your browser.

JavaScript, TypeScript or JSX

Stays in your browser

Result

The result appears here.

Shortcuts: Ctrl+Enter run · Ctrl+Shift+C copy result · / search (use ⌘ on Mac)

Next steps

Done here? Use the Send to… menu on the result to carry it on to JavaScript Minifier or HTML Beautifier.

Free Online JavaScript Beautifier

Turn minified or messy JavaScript into readable code. Choose JavaScript, TypeScript or JSX and your preferred style. It gives developers a quick browser-based way to solve a focused javascript beautifier task before moving the result into a project.

How to use the javascript beautifier

Paste your code in the box, adjust the options if you want, and press Format. The code is formatted with Prettier. Pick the language, indent, quote style, semicolons, trailing commas and line width, then press Format.

Common mistakes

  • Pick TypeScript for code with type annotations, otherwise the JavaScript parser stops at the first type.
  • Syntax errors are reported with a line and column; fix the first one and format again.

Frequently asked questions

Does formatting change what my code does?
No. Only whitespace, quotes, semicolons and line breaks change. Formatting the result again gives the same text.
Why does TypeScript need its own mode?
Types such as interfaces and annotations are not valid JavaScript, so the TypeScript mode uses a parser that understands them.
Is my code uploaded?
No. Formatting runs in your browser.
How do I use this javascript beautifier tool?
Use the interactive controls above; processing stays in your browser and the result is intended as a practical starting point for development work.

More Formatters & Parsers

View all Formatters & Parsers tools →