JavaScript Minifier
Minify JavaScript code with Terser — mangle variables, strip dead code, and show size reduction instantly.
How to use JavaScript Minifier
-
Paste your JavaScript
Paste your JavaScript code into the input panel on the left.
-
Choose minification options
Toggle Mangle to rename variables to shorter names. Toggle Compress to enable dead code elimination and expression simplification.
-
Click Minify
Click the Minify button to compress your code. Original size, minified size, percentage reduction, and estimated gzip size are shown below.
-
Copy the result
Click Copy to copy the minified JavaScript to your clipboard, ready for your production bundle or CDN.
JavaScript Minifier FAQ
What is JavaScript minification?
What does mangle do and is it safe?
What does compress do?
What JavaScript versions are supported?
Is my code sent to a server?
What is the estimated gzip size?
Can I use this for TypeScript?
Does this work with ES modules (import/export)?
Can I minify multiple files at once?
Background
JavaScript Minifier compresses JS files for production using Terser, the same engine behind webpack, Vite, and esbuild's minification step. It removes whitespace, comments, and unnecessary syntax, then optionally mangles variable and function names to the shortest possible form and applies compression passes to eliminate dead code and simplify expressions.
The results panel shows original file size, minified size, percentage reduction, and an estimated gzip size so you understand the real transfer savings once your server applies compression.
Terser supports the full modern JavaScript surface: ES6+ arrow functions, destructuring, template literals, async/await, optional chaining, nullish coalescing, private class fields, and top-level await. Mangle mode renames local variables to single letters (firstName becomes a) for maximum compression — safe for most code but always worth testing. Compress mode applies logical simplifications like removing unreachable branches and inlining constants.
All processing runs in your browser with no code sent to any server. Paste your unminified JS, click Minify, and copy the production-ready output.
Related tools
CSS Minifier
Minify and compress CSS for production — strip whitespace, merge rules, and show size reduction instantly.
SVG Optimizer
Optimize and compress SVG files with SVGO — remove metadata, comments, and redundant paths for 40–80% size reduction.
JSON Formatter
Format, validate, and minify JSON instantly — with configurable indentation, error location, and tree view.
Diff Checker
Compare two texts, code files, or documents side by side — word-level diff highlighting, private and browser-based.