JS Minifier

Compress JavaScript by removing comments, whitespace, and unnecessary characters to reduce file size and improve load performance.

Input JavaScript
Minified JavaScript
⚠️ This is a basic minifier. It removes comments and collapses whitespace but does not rename variables or perform dead-code elimination. For production use, consider a full-featured bundler like esbuild or Terser.

About JS Minifier

JavaScript minification reduces file size by stripping developer-facing content that the browser doesn't need — comments and indentation whitespace. This tool performs safe, comment-aware minification that respects string literals and regex patterns so the output code is functionally equivalent to the input.

What this tool does

  • Removes single-line comments — Strips // ... comments (safe, aware of strings).
  • Removes block comments — Strips /* ... */ blocks.
  • Collapses whitespace — Replaces multiple spaces and newlines with a single space where safe.

FAQ

This tool is string-literal aware so it won't accidentally remove comment-like content inside strings. However, it does not parse the full JS AST. For complex code with regex literals, test the output. For production, use esbuild or Terser.
No. All processing runs in your browser. Your JavaScript is never transmitted anywhere.