JavaScript Minifier
The JavaScript Minifier is a free online tool that compresses JS code to reduce file size. Powered by Terser, the industry-standard ES6+ minifier, it removes whitespace, shortens variable names, eliminates dead code, and strips debug statements to produce lean, production-ready output.
Why Minify JavaScript
Faster Load & Parse
Smaller Bundles
Cleaner Production Code
How to Minify JavaScript
Paste or Upload Your JS
Type or paste your script into the input panel on the left, or use Upload to load a .js file. Press Sample to load example code.
Configure Terser Options
Toggle Mangle, Compress, Drop console, and Drop debugger to tune how aggressively the code is optimized.
Minify
Click Minify or press Ctrl + Enter. Terser processes the code and the result appears instantly in the output panel.
Review & Export
Check the stats bar for original size, minified size, and savings. Then Copy the output or Download it as a file.
Optimizations & Features
Terser Options Explained
Each option maps to a Terser transformation. Together they handle modern ES6+ syntax and produce reliable production output.
| Option | What It Does | Default |
|---|---|---|
| Mangle | Shortens local variable and function names (e.g. userName → a) | On |
| Compress | Applies dead-code elimination and dozens of size optimizations | On |
| Drop console | Removes all console.* calls | Off |
| Drop debugger | Removes debugger statements | On |
Production-Grade Engine
Full ES6+ Support
Terser understands arrow functions, classes, template literals, async/await, and other modern syntax.
Debug Cleanup
Strip console output and debugger breakpoints so they never ship to production.
Compression Stats
See original size, minified size, and the percentage saved after every run.
Upload or Paste
Load a .js file from disk or paste code directly — whichever suits you.
Frequently Asked Questions
Is my code sent to a server?
No. Terser runs locally in your browser. Your JavaScript is never uploaded, logged, or stored anywhere.
What does "Mangle" do?
Mangling shortens local variable and function names — for example myVariable becomes a — to cut file size without changing how the code behaves. It only renames identifiers that are not exposed externally.
Should I enable "Drop console" for production?
Usually, yes. Removing console.log calls reduces file size and prevents debug information from leaking to users. Keep it off if your app intentionally logs to the console in production.
What minification engine is used?
This tool uses Terser, the most widely adopted JavaScript minifier and the same engine behind many modern bundlers. It fully supports ES6+ syntax.
Can it break my code?
Terser is highly reliable, but aggressive mangling can affect code that depends on identifier names at runtime (such as some reflection or serialization tricks). Always test the minified output before deploying, and keep your original source.
No comments yet. Be the first to comment!