Free JavaScript Minifier
Shrink your JavaScript for production without breaking it. This free minifier strips comments and unnecessary whitespace with full awareness of strings, template literals, and regex — so your code keeps working — then shows exactly how many bytes you saved.
Minified JavaScript
How to Use the JavaScript Minifier
- Paste your JavaScript into the input box.
- Click Minify JavaScript — the compressed code appears instantly.
- Check the savings report for before/after sizes.
- Copy or download the minified .js for production.
Features
The minifier parses strings (single, double, and backtick), line and block comments, and regex literals, so it never strips a // inside a URL string or mangles a regex. It collapses whitespace runs, removes spaces around punctuation, drops comments, and guards tricky cases like a + +b so semantics never change. A byte-savings report quantifies every run.
Benefits & Use Cases
Smaller JS bundles parse and execute faster, improving load times and Core Web Vitals. Developers minify scripts before deploying static sites, shrink bookmarklets and embed codes, and compare savings across refactors — all without installing a build toolchain. Local processing keeps proprietary code private.
Tips
This minifier removes whitespace and comments but does not rename variables — for maximum compression, run production bundles through Terser or esbuild. Always test minified output, and keep the readable source as the file you actually edit.
Frequently Asked Questions
Will minification break my JavaScript?
A correct minifier only removes characters that do not affect execution. This tool protects strings, template literals, and regex, and preserves required spaces (like between keywords), so semantics stay intact — but always test the output.
Does it rename variables like UglifyJS?
No. This is a whitespace-and-comment minifier; identifiers are untouched. Full mangling requires a build tool like Terser or esbuild, which you should use for production bundles.
How much smaller will my code get?
Typically 20–50% depending on comments and formatting style. Heavily commented, generously spaced code shrinks the most — the tool reports your exact savings.
Should I remove console.log statements?
For production, yes — they add bytes and can leak internals. This tool keeps them (it only touches whitespace/comments), so strip them in your build step or manually first.
Is my code uploaded anywhere?
No. Minification runs entirely in your browser — your JavaScript never leaves your device.
Related Tools
JavaScript Formatter
Beautify minified JavaScript with NToolHub’s free formatter. Smart brace indentation, string-safe — readable code instantly, 100% private.
Open tool →CSS Minifier
Minify CSS for production with NToolHub’s free minifier. Strips comments and whitespace safely — see byte savings instantly, 100% private.
Open tool →HTML Minifier
Minify HTML for production with NToolHub’s free minifier. Removes comments and whitespace safely, protects scripts — see savings instantly.
Open tool →JSON Minifier
Minify JSON for production with NToolHub’s free minifier. Validates first, strips all whitespace, shows savings — 100% private.
Open tool →SQL Minifier
Minify SQL queries with NToolHub’s free minifier. Strips comments and whitespace safely, protects strings — private in-browser tool.
Open tool →