Free Online JavaScript Minifier

JavaScript minification removes comments and collapses whitespace to shrink a script's byte size — useful for inline `<script>` tags and quick experiments.

Your data is processed entirely in your browser and never sent to any server.

Instant results 100% private No signup needed
Strips comments and collapses whitespace only. For production builds, use Terser or esbuild.

How to Use This Developer Tool

  1. Paste your JavaScript into the input area.
  2. Read the minified output below.
  3. Check the size reduction shown beneath the output.
  4. Click Copy to send the result to your clipboard.

What Is a JavaScript Minifier?

For production builds, you want Terser or esbuild — they do real work like renaming identifiers, dropping unreachable code, and inlining constants. For a one-off script you want to paste into a `<script>` tag, embed in an email, or attach to a CDN snippet, a comments-and-whitespace pass is usually enough and finishes instantly.

This minifier strips `//` line comments and `/* … */` block comments, then collapses consecutive whitespace. String literals (single, double, template) and regex literals are preserved byte-for-byte — what's inside the quotes or between the regex delimiters stays exactly as you wrote it.

Frequently Asked Questions

What does JavaScript minification do?
Minification removes whitespace and comments to reduce file size. It does not rename variables — for that, use Terser in your build.
Is this safe for production?
For straightforward scripts, yes. For library code with regex, template literals and ASI edge cases, prefer Terser or esbuild.
Is minified code harder to debug?
Yes, minified code is hard to read. Always keep source maps for production debugging.

Published by the WeGotEveryTool team. We build and test every tool in-house and update pages when the underlying spec, formula, or recommendation changes.

Reviewed: May 2026. Disclaimer: this tool is provided as-is for general informational use. For decisions with material consequences (medical, legal, financial, security) verify results against a qualified professional source.

Related Developer Tools