📦 JavaScript Minifier

Minify JavaScript code by removing comments, whitespace, and unnecessary characters — all in your browser, no upload, instant results.

Original: 0 bytes Minified: 0 bytes Savings: 0%

About the JavaScript Minifier

This JavaScript minifier runs entirely in your browser. Paste your JavaScript code into the input box, click Minify, and the minified output appears in the output box along with size savings statistics. Nothing is uploaded to a server — minification happens locally with safe text-based transformations.

What gets removed

  • Comments — Both single-line (//) and multi-line (/* */) comments are stripped.
  • Whitespace — Leading and trailing whitespace on each line, plus consecutive blank lines, are collapsed.
  • Unnecessary semicolons — Semicolons right before } or end of line may be removed where safe.
  • Line breaks — Most line breaks between tokens are removed.

How to use

  1. Paste your JavaScript code in the input box.
  2. Toggle the comment-removal option as needed.
  3. Click Minify to compress the code.
  4. Review the size savings stats and the output.
  5. Click Copy to copy the result, or Clear to start over.

Frequently asked questions

Does this tool upload my code? No. All minification happens locally in your browser. Your code never leaves your device.

Is this minifier safe for production code? It performs safe text-based minification. For mission-critical production builds, consider a full parser-based tool like Terser or esbuild. Always test minified output before deploying.

Does it mangle variable names? Variable mangling is marked experimental because proper mangling requires a full parser. It is off by default.

Are template literals and regex preserved? The tool avoids stripping whitespace inside template literals (`...`) and string literals, but regex literals may need manual review.