Free JS Minifier & Obfuscate-Lite Tool
Shipping unminified JavaScript wastes bandwidth on every page load. This free tool offers two transforms: safe minify, which strips comments and squeezes whitespace while preserving newlines, strings, template literals, and regex patterns; and obfuscate-lite, which additionally renames declared variables to short identifiers. Everything runs locally — proprietary code never leaves your machine.
How to Minify Safely
- Paste your script — files up to several hundred kilobytes process instantly.
- Click Minify for comment-free, whitespace-squeezed output, or Obfuscate Lite to also shorten the first 26 declared identifiers.
- Test before deploying — run the output through your test suite or at least load the page; restore the original anytime with one click.
What Gets Removed (and What Is Protected)
The scanner is string-aware: contents of single quotes, double quotes, and template literals pass through byte-identical, and a heuristic detects regex literals (a / following operators, brackets, or keywords like return and typeof) so patterns like /a\/b/gi survive. Line and block comments are deleted, whitespace runs collapse, and spaces around punctuators vanish — while spaces between word characters (return x, typeof y) are preserved because removing them would break syntax. Obfuscation uses word-boundary renaming that skips property access after dots.
Will minified code run identically?
Safe minify: yes, barring exotic reliance on comments or exact whitespace (vanishingly rare). Obfuscate-lite: usually, but naive renaming can collide with dynamic property lookups like obj[myVar] — hence the mandatory testing warning.
How much smaller do files get?
Comment-heavy development code typically shrinks 30–60%; already-tight code 10–20%. Gzip on your server compresses further on top.
Is this real obfuscation?
No — it deters casual reading only. Determined reverse engineers defeat renaming in minutes. For genuine protection, use WebAssembly or server-side logic for secrets.
Related Tools
Format stylesheets with the CSS Formatter, beautify markup with the HTML Formatter, and validate data with the JSON Formatter.