JavaScript Minifier

Minify JavaScript by removing whitespace and comments. Variable names are preserved. Paste code and click Run.

  • Runs entirely in your browser
  • No data stored or sent to a server
  • Free forever — no signup
  • Instant conversion

Input and Output

Use the interactive encoder and decoder on this page to process your text.

Learn more about JavaScript

How to Minify JavaScript

JavaScript Minification

When to Minify JavaScript

Compress scripts for production bundles, compare minified output sizes, or inspect how whitespace removal affects code length before deploying static assets or embeddable widgets.

What Minify Does

Removes comments and unnecessary whitespace. Variable names are not mangled, so output remains easier to debug than aggressively optimized production builds that rename identifiers.

Common Mistakes

  • Expecting minify to fix syntax errors — invalid code will fail
  • Running untrusted minified output without reviewing it first
  • Assuming minified size equals gzip size — always measure compressed bytes

Frequently asked questions

Is minified output safe to run?

Minified code is still executable JavaScript. Only run output you trust, same as any source code.

Why are variable names preserved?

Preserving names keeps minified output easier to debug than production builds that mangle identifiers.