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

Private by design. This tool runs 100% in your browser — your code is never uploaded to any server.

How to Use the JavaScript Minifier

  1. Paste your JavaScript into the input box.
  2. Click Minify JavaScript — the compressed code appears instantly.
  3. Check the savings report for before/after sizes.
  4. 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