JavaScript Minifier
Minify JavaScript with advanced options. Remove comments, collapse whitespace, strip console.log, shorten booleans — all locally in your browser.
Aggressive Minification
Strip comments, collapse whitespace, remove empty rules, and shorten redundant values. Every byte counts.
Smart Shortening
Shorten booleans (!0 / !1), remove console.* calls, drop debugger statements, and collapse leading zeros.
Private & Local
Everything runs in your browser. Your JavaScript — including proprietary logic and API keys in comments — never leaves your device.
Why minify JavaScript?
Minified JavaScript files are smaller and transfer faster over the network, improving page load times and Core Web Vitals. Every byte saved contributes to a faster, more responsive website — especially important for mobile users on slower connections.
What each option does
- Remove comments — strips all
//and/* … */comment blocks. - Collapse whitespace — removes extra spaces, tabs, and line breaks between tokens.
- Remove console.log / console.* — deletes
console.log,console.warn,console.error, and related calls. - Remove debugger — drops
debugger;statements that pause execution in dev tools. - Shorten booleans — replaces
truewith!0andfalsewith!1. - Remove last semicolons — drops the final semicolon before each closing brace.
- Shorten undefined — replaces
undefinedwithvoid 0. - Remove leading zeros — converts
0.5to.5.
When not to minify
Only minify the version you ship to production. Keep the original, un-minified file in version control and as your source of truth. If you work with JavaScript transpilers like Babel or TypeScript, minify the compiled output, not the source files.
Frequently asked questions
›What is a JavaScript minifier?
A JavaScript minifier removes unnecessary characters — like whitespace, comments, and redundant syntax — from JS code without changing how it executes. The result is a smaller file that downloads faster.
›Is this JS minifier safe to use?
Yes. All processing happens entirely in your browser (client-side). Your JavaScript is never uploaded to a server, so it stays completely private and secure.
›What minification options does this tool offer?
You can toggle: remove comments, collapse whitespace, remove console.log / console.* calls, remove debugger statements, shorten booleans (true → !0, false → !1), remove last semicolons, shorten undefined → void 0, and remove leading zeros (0.5 → .5).
›Will minifying JavaScript break anything?
No for well-formed code. The minifier preserves quoted strings, template literals, and regex literals. The resulting code executes identically in browsers and Node.js.
›How much smaller will my JS get?
Typical savings range from 15% to 50%, depending on how verbose your original code is. The tool shows real-time byte count and percentage reduction so you can see the exact savings instantly.
›Can I upload a .js file?
Yes. Click the 'Upload .js' button to load a script directly from your computer. You can also download the minified result as a .js file.
›Does removing console.log break my app?
Only if your program logic depends on console.log output. The minifier removes console.log, console.warn, console.error, and related calls. This is usually safe for production but can be disabled if you need to keep them.
›Does it support ES2023+ syntax?
Yes. The minifier preserves modern syntax like arrow functions, async/await, optional chaining, nullish coalescing, template literals, destructuring, class fields, and more.
›Can I use this JS minifier in my build pipeline?
This is a browser tool for quick, one-off minification. For production build pipelines, use dedicated tools like Terser, esbuild, or UglifyJS which integrate with bundlers like Webpack, Vite, and Rollup.
More free developer tools
Part of our growing tool belt — all client-side, all free.
JSON Formatter & Beautifier
Format, beautify, minify and validate JSON with sort keys, ASCII escape, and tree view.
Open toolJSON Validator
Strict JSON validator with precise error location, lint hints, structure stats, and duplicate key detection.
Open toolJSON Viewer
Interactive JSON tree explorer with filter, copy-path, expand/collapse all, and colour-coded types.
Open tool