JavaScript Beautifier & Minifier
Format, beautify, and minify JavaScript in your browser. Configure indentation, toggle strict mode, and compare input vs output size. No upload, no size limit.
How it works
- Beautify pretty-prints the JS with configurable indentation and preserved comments (except line comments, which are stripped as they are invalid in some JS contexts after minification).
- Minify removes all non-essential whitespace, strips comments, replaces local variable names with short identifiers, and collapses the output to the smallest valid representation.
- The byte count comparison shows exact input vs output size so you can measure the compression ratio.
- Runs entirely in the browser — nothing is uploaded or transmitted.
What the minifier does
The minifier performs four passes: (1) remove comments and block comments, (2) replace all optional semicolons with ASI-compatible newlines, (3) collapse consecutive whitespace to single spaces or newlines, and (4) rename local variables to shorter names using a safe rename map that preserves global scope. Strings are never touched.
Safety guarantees
Global `var`/`let`/`const` declarations, `window.*`, `document.*`, `localStorage`, and any identifier assigned to an object literal are excluded from renaming. The minifier targets only function-scoped identifiers. For complete minification with tree-shaking and dead-code elimination, use a build tool like esbuild, terser, or swc — they run at build time and have full module context.
Next steps
- CSS Formatter— complete the frontend trio
- HTML Prettifier— format or minify HTML
Frequently Asked Questions
How do I minify JavaScript?
Does minification rename all variables?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.