Js Minifier
JavaScript minification reduces file size by removing whitespace, shortening variable names, and eliminating dead code — without changing behavior. It is a critical step in any production web build. Our minifier uses a proper AST-based approach (not simple string replacement) to safely minify JS while preserving functionality.
Input JS
Minified (% smaller)
About the JavaScript Minifier
JavaScript minification reduces file size by removing whitespace, shortening variable names, and eliminating dead code — without changing behavior. It is a critical step in any production web build. Our minifier uses a proper AST-based approach (not simple string replacement) to safely minify JS while preserving functionality.
How to use it
- Paste JavaScript code into the input area.
- Choose options: mangle variable names, drop console.log, remove dead code.
- See minified output with size reduction and a source map option.
- Beautify existing minified JS to make it human-readable for debugging.
Formula & methodology
Transformations: remove whitespace and comments; shorten variable/function names (a, b, c...); inline simple variables; remove unreachable code; replace long literals (true/false → !0/!1); combine consecutive var declarations. Advanced: tree-shaking (remove unused exports — requires module analysis). Typical savings: 30–70% on unminified JS.
Common use cases
- Production build: minifying application JS before CDN deployment
- Bundle size audit: measuring how much minification improves load time
- Legacy code: minifying inline scripts without a build pipeline
- Debugging: beautifying minified library code to inspect behavior
- Performance budget: ensuring minified JS stays under target size limits
Frequently asked questions
Related tools
All Tools →Embed this tool on your site
Free for personal and commercial use. Just copy the snippet below.