JS Minifier
Safely minify JavaScript by removing comments and collapsing whitespace — without breaking your code. 🔒 No variable renaming. No uploads. Token-accurate.
🔍 What Is a JS Minifier?
A JS Minifier reduces the size of JavaScript files by removing characters that the browser does not need — comments, indentation, and redundant whitespace. Smaller JavaScript files download faster, parse quicker, and improve Core Web Vitals scores like Largest Contentful Paint (LCP) and Total Blocking Time (TBT).
◆ This tool processes everything entirely in your browser — no code is ever uploaded to any server. Your JavaScript stays private.
✨ Key Features
Genuinely Safe Minification
Built on a real JavaScript tokenizer — not naive regex. It correctly preserves automatic semicolon insertion (ASI), regex literals, template literals, and string escapes.
Smart Comment Removal
Removes // line comments and /* */ block comments — while optionally preserving /*! ... */ banners, @license, @preserve, and IE conditional compilation comments.
Optional Debug Cleanup
Strip console.log() calls and debugger statements before shipping to production — replaced with safe no-op expressions.
Size & Savings Report
See original size, minified size, percentage saved, and lines removed — instant feedback on your optimization gains.
No Variable Mangling
Variables and function names are left untouched. This makes the output predictable and safe — you can still read it in DevTools if needed.
Copy & Download
Copy the minified code to your clipboard or download it as a .min.js file ready for deployment.
💡 Why Use This JS Minifier?
100% Private & Secure
All processing happens in your browser. Your JavaScript never leaves your device — no uploads, no servers, no tracking.
Works Everywhere
Use it on your phone, tablet, laptop, or desktop. The interface adapts to any screen size.
Instant Results
Minification happens in milliseconds. No page reloads, no waiting — just paste and click Minify.
Completely Free
No sign-up, no hidden fees, no usage limits. Use it as much as you need.
Accessible & Keyboard-Friendly
Full keyboard support, visible focus states, and semantic HTML ensure everyone can use the tool effectively.
Works Offline
Once the page loads, the tool works entirely offline — no internet connection required.
📖 How to Use the JS Minifier
- Paste your JavaScript into the input area. You can also click Sample to load an example.
- Choose your options — toggle comment removal, license preservation, console stripping, and debugger stripping.
- Click Minify to generate the compressed output. The result appears instantly.
- Review the stats — see the original size, minified size, percentage saved, and lines removed.
- Copy or Download — click Copy for the clipboard, or Download to save as a
.min.jsfile. - Clear everything to start fresh, or press Ctrl+Enter to minify instantly.
🎯 Practical Use Cases
Production Deployment
Minify JavaScript before deploying to production to reduce bundle size and improve page load speed.
Core Web Vitals
Smaller JS files improve LCP, FID, and TBT scores — directly influencing Google's page experience signals.
WordPress & CMS Optimization
Minify theme and plugin scripts to reduce render-blocking JavaScript and speed up your CMS.
Quick One-Off Minification
When you need to minify a single script but don't want to install Node.js, Terser, or a build tool.
Email & Landing Page Snippets
Compress inline tracking scripts and small utilities that get embedded directly into HTML.
Learning Minification
See exactly what a minifier does to your code — useful for understanding ASI, comment handling, and token separation.
⚠️ Important Notes & Limitations
🔹 No variable renaming: This tool does not mangle variable names (unlike Terser or UglifyJS). That's a deliberate safety choice — the output stays readable and predictable. For maximum compression, combine with gzip or Brotli on your server.
🔹 ASI handling: Automatic Semicolon Insertion is respected. Newlines after return, throw, break, continue, yield, and debugger are preserved, and newlines before non-continuable tokens are kept to avoid changing program behavior.
🔹 console.* stripping is expression-safe: Stripped console calls are replaced with 0 — a safe no-op — so they can be removed even inside expressions, ternaries, or if bodies without braces.
🔹 Test after minifying: Always run your test suite or manually verify functionality after minification. Every real-world minifier can interact unexpectedly with exotic or generated code.
❓ Frequently Asked Questions
A safe minifier removes: line comments (//), block comments (/* */), indentation, and redundant whitespace between tokens. It preserves string contents, regex literals, template literals, and any whitespace that is semantically required (for example, the space between return and its operand). This tool also optionally removes console.* calls and debugger statements.
Absolutely 100% safe. This tool processes everything in your browser using vanilla JavaScript. No code is ever sent to any server, stored, or shared with third parties.
Variable renaming (mangling) requires full scope analysis and can break code that uses eval(), with, dynamic property access, or exported names. This tool deliberately skips mangling to guarantee safe, predictable output. If you need maximum compression, pair the output with server-side gzip or Brotli — you'll typically get better total savings than mangling alone.
It should not. This minifier is designed to preserve program behavior — it never removes line terminators where automatic semicolon insertion matters, and it never touches string or regex contents. That said, you should always test your code after minification, because every minifier can interact unexpectedly with unusual or machine-generated code.
Yes! Once the page loads, the tool works entirely offline. You can bookmark it or save the page (HTML) for offline use.
Completely free, forever. No sign-up, no registration, no hidden fees, no usage limits. This tool is proudly offered by GenieDevs as a free resource for the developer community.
👨💻 About the Author — GenieDevs
📦 Get the Standalone Version
⚡ JS Minifier – Standalone Edition
Get the complete, self-contained HTML version of this tool. Perfect for offline use, intranet deployments, or embedding in your own projects. No dependencies, no external calls — just one HTML file that works anywhere.
🎯 Final Takeaway
The JS Minifier is your safe, dependable tool for shrinking JavaScript files without risking your code. It uses a real tokenizer, respects automatic semicolon insertion, and never renames your variables — so the output is both smaller and predictable.
✨ Try it now — paste your JavaScript, click Minify, and see the savings instantly. With its 100% browser‑based architecture, your code stays private.
🚀 Share this tool with your fellow developers. Explore our growing collection of free utilities at GenieDevs.