JavaScript Minifier — Smaller Files, Faster Loads

Strip comments and collapse whitespace from your JavaScript while protecting strings and template literals. See the exact bytes saved.

100%Free
0Signup Required
0Data Leaves Browser

JavaScript Minifier

Free • No Signup
Live — results update as you type
0 B input0 B output0% saved gzip estimate

Quick Answer

A JavaScript minifier removes comments, blank lines and unnecessary whitespace from your code, shrinking the file the browser has to download. This tool is deliberately conservative: strings, template literals and comments inside them are preserved exactly, so behavior never changes.

What This Tool Does

The minifier tokenizes your code so it never edits inside strings, template literals or comments. Comments are removed, whitespace runs collapse safely, and — with the Mangle variable names option — locally declared variables and function parameters are renamed to short names like a or b, the same trick Terser-style tools use. The result is smaller without changing what the code does.

Key Features

  • String-safe — quotes, template literals and escape sequences are untouched.
  • Comment removal// line and /* block */ comments are stripped.
  • Variable mangling — shorten local variable names and parameters (scope-aware, skips properties, object keys, templates and globals).
  • Independent options — toggle comment removal, whitespace collapsing and mangling separately.
  • Live savings + gzip estimate — input/output size, percentage saved, and an approximate gzipped size.
  • Upload file or load from URL — minify existing scripts directly.
  • Copy or download the minified file.

How to Use the JavaScript Minifier

  1. Paste your JavaScript into the input box, or use Upload File / Load from URL.
  2. Open Show advanced options and tick Mangle variable names for maximum savings (on by default).
  3. Read the minified output and the size stats, including the gzip estimate.
  4. Click Copy or Download to take the result.

Use Cases

  • Quickly shrinking a script before pasting it into a single-file page.
  • Preparing an inline snippet where size matters.
  • Seeing how much overhead comments and formatting add to a file.

Tips

  • This is lightweight minification. For production, a real bundler also does dead-code elimination, which saves far more.
  • Keep the readable source in version control; minify at build time.
  • Test the minified output once before shipping — a quick smoke test catches surprises.

Privacy

Your code never leaves your browser. Safe even for proprietary scripts.

Conclusion

Smaller JavaScript means faster pages. Minify here, instantly and privately, then wire it into your real build pipeline.

FAQ

Frequently Asked Questions About JavaScript Minifier

No — the minifier only removes comments and whitespace and never touches the inside of strings, template literals, or the logic itself. The same code still runs.

A bundler (Vite, webpack, esbuild) is the right tool for real projects — it also removes dead code. This tool is for quick one-off minification when you just need a smaller file now.

Typically 15–35% with whitespace/comment removal alone; adding variable mangling can push savings to 40–60%. The live stats and gzip estimate show your exact numbers.

Yes — minification happens entirely in your browser; your source never leaves your device.

Mangling renames local variables and function parameters to short names like a, b, c… It is scope-aware: properties, object keys, template expressions and global names are never touched. Avoid it only if your code reads function names at runtime via toString() or similar.

Yes — use the Upload File button to read a local .js file, or paste a URL into the Load from URL field. Everything still stays in your browser.

More Tools

Code Faster, Not Harder

Format, minify, test and generate — free developer utilities that run entirely in your browser.