onlinetools.dev

JavaScript Formatter & Minifier

Beautify JavaScript or minify it with real compression and mangling

Runs locally
loading…
About this tool

Beautify JavaScript with consistent indentation and spacing — deminify a vendored bundle to read what it actually does, or clean up code pasted from a console. The minifier is the real thing: Terser parses your code into an AST, drops dead code, shortens local variable names and strips comments, the same engine bundlers use in production.

Because minification is AST-based, it never breaks working code the way regex-based "compressors" can: strings, template literals, regexes and ASI edge cases are handled by an actual parser. Syntax errors are reported with position instead of producing corrupt output.

Terser loads only when you first minify, keeping the page light, and it runs entirely in your browser — proprietary source never leaves your machine.

Frequently asked questions

How much smaller will my code get?
Handwritten code typically drops 30–60% before gzip: whitespace, comments and long local names carry that much weight. Code that is already bundled shrinks far less — it has been through the same transform once already.
Does minification change behavior?
Compression and mangling preserve semantics: only local names are renamed, and dead-code elimination removes branches that provably cannot run. Code that relies on Function.prototype.name or toString() of its own functions is the classic exception.
Can this un-minify production code from a website?
The formatter restores whitespace and structure, which makes control flow readable — but original variable names and comments are gone forever; you will see a, b, c. For serious debugging, prefer source maps if the site ships them.
Does it support TypeScript or JSX?
No — both need their own parsers. Compile to JavaScript first (tsc, esbuild), then format or minify the output here.
Related tools