Developer Tools
JavaScript Formatter & Beautifier
Turn minified or badly indented JavaScript into clean, readable code. Ideal for reading third-party scripts, debugging bundled code and tidying snippets before sharing them.
Format JavaScript
Paste JavaScript, choose indentation and brace style, and press Format.
How to Beautify JavaScript
- Paste your code: a minified library, a snippet from Stack Overflow, or code from an old project.
- Choose spaces or tabs and whether opening braces stay on the same line or move to a new line.
- Press Format, then copy or download the result.
Unminifying Code
Minified files remove line breaks and indentation, and often rename variables to single letters. The formatter restores line breaks and indentation so you can follow the logic, set breakpoints and search the code. It cannot restore the original variable names or comments; for that you need the project's source map.
What Is Supported
- Modern JavaScript: arrow functions, classes, async/await, template literals, optional chaining and modules.
- JSON, which is formatted like a JavaScript object. For strict validation use the JSON Formatter.
- Most JSX used in React components.
TypeScript-specific syntax such as type annotations usually formats well, but complex generics may need tidying by hand. For projects, a formatter such as Prettier in your editor keeps the whole codebase consistent automatically.
Brace Styles
"Same line" (also called K&R or 1TBS) is the most common style in JavaScript and is used by Prettier and most style guides. "New line" (Allman style) is popular with developers coming from C# and some older codebases. Choose the one your team uses.
Privacy
Formatting happens in your browser. Your code is never uploaded, so it is safe for private and proprietary scripts.
Frequently Asked Questions
Can I unminify JavaScript?
Yes. Paste minified code and press Format to restore indentation and line breaks. Original variable names and comments cannot be recovered without a source map.
Does formatting change what my code does?
No. Only whitespace and line breaks change, so the code behaves exactly the same.
Can it format TypeScript or JSX?
Most JSX and simple TypeScript format correctly. Complex type definitions may need small manual adjustments.
Why is there no Minify button?
Safe JavaScript minification requires a full compiler such as Terser or esbuild, which should be part of your build process rather than a copy-and-paste step.