JavaScript Minifier

Minify JS for production or beautify for readability.

JavaScript Minifier β€” What It Does

Paste JavaScript code to strip whitespace, comments, and unnecessary characters for a production-ready minified output. Or paste minified code to beautify it back into readable, indented format. Both operations run entirely in your browser β€” no code is sent to any server. Useful for optimising inline scripts, inspecting third-party snippets, or quickly preparing code for deployment.

What Minification Removes

Minification vs Build Tools

Tips for Safe Minification

Frequently Asked Questions

What does JavaScript minification actually do to the code?
Minification removes all characters that are unnecessary for execution: whitespace, newlines, comments, and optional semicolons. Advanced minifiers also shorten variable names (a, b, c instead of userAccountDetails), collapse constant expressions, and remove dead code branches. The result is functionally identical but much smaller.
How much file size reduction should I expect from minification?
For typical JavaScript files with comments and readable formatting, minification reduces file size by 20–50%. When combined with gzip compression (which web servers apply automatically), the effective saving is often 60–80% compared to the original uncompressed, unminified source.
What is the difference between minification and obfuscation?
Minification optimises for file size by removing unnecessary characters. Obfuscation deliberately transforms code to make it hard to read and reverse-engineer β€” using nonsensical variable names, encrypting string literals, and adding confusing control flow. Minification is a routine production step; obfuscation is used when source code protection matters.
Should I minify JavaScript manually or use a build tool?
For production projects, use a build tool like webpack, Vite, Rollup, or esbuild β€” they handle minification automatically as part of the bundle step, along with tree-shaking, code splitting, and source maps. Manual minification via this tool is useful for quick one-off tasks, third-party snippets, or checking minified output.
Can I un-minify or beautify minified JavaScript to read it?
Yes β€” the beautify mode in this tool reformats minified JavaScript with consistent indentation and line breaks, making it readable. Note that variable names shortened by the original minifier cannot be recovered. For debugging minified production code, use browser DevTools source maps if available.