Minify JavaScript to Shrink File Size
This JavaScript minifier compresses your JS in the browser to reduce file size and speed up page loads. Powered by Terser, the industry-standard ES6+ minifier, it strips whitespace and comments, shortens local variable names, removes dead code, and drops debug statements to produce lean, production-ready output.
Why Minify JavaScript
Faster Load & Parse
Smaller Payload
Cleaner Production Code
How to Minify JS Code
Paste or Upload Your JS
Type or paste your script into the input panel, or use Upload to load a .js file. Press Sample to drop in example code.
Configure Terser Options
Toggle Mangle, Compress, Drop console, and Drop debugger to tune how aggressively the code is optimized.
Minify
Output updates automatically as you type (debounced). To run it now, press Ctrl + Enter and the result appears instantly in the output panel.
Review & Export
Check the stats bar for original size, minified size, and percent saved. Then Copy the output or Download it as minified.js.
Terser Optimizations & Features
Minification Options Explained
Each toggle maps to a Terser transformation. Comments are always stripped from the output regardless of the toggles below.
| Option | What It Does | Default |
|---|---|---|
| Mangle | Shortens local variable and function names (e.g. userName → a) | On |
| Compress | Applies dead-code elimination and many 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.
Live Compression Stats
See original size, minified size, and percent saved after every run, plus syntax-highlighted output.
Upload, Copy & Download
Load a .js file or paste code, then copy the result or download it as minified.js.
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.
Does minifying JavaScript improve page speed?
Yes. Removing whitespace, comments, and long identifier names shrinks the file so it downloads and parses faster. The stats bar shows exactly how many bytes you save on each run. Minification pairs well with gzip/Brotli compression on the server.
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.* 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.
Can I unminify or reverse the output?
Minification is one-way. You can re-indent minified code with a formatter to make it readable again, but mangled variable names and removed comments cannot be restored — always keep your original source.
What minification engine is used?
This tool uses Terser (version 5.46.0), the most widely adopted JavaScript minifier and the same engine behind many modern bundlers. It fully supports ES6+ syntax.
Can minification 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!