Skip to content
Browser tool Runs locally

JavaScript Minifier

Minify JavaScript by removing unnecessary formatting whitespace while preserving program semantics.

JavaScript input
0 chars
Minified JavaScript
Minified JavaScript will appear here.
Examples:

How to minify JavaScript

  1. Paste JavaScript in the input panel.
  2. Click Minify JavaScript.
  3. Review the byte savings.
  4. Copy or download.

What JavaScript minification does

  • Removes indentation, line breaks, and separator whitespace.
  • Removes ordinary comments.
  • Preserves ASI semantics via AST-based printing.
  • Uses minimum necessary whitespace to prevent token merging.

What this minifier does not do

  • No variable or property renaming.
  • No dead-code elimination.
  • No constant folding or expression rewriting.
  • No transpilation of modern syntax.

JavaScript minification vs. compression

Minification reduces source bytes; gzip and Brotli are binary compression on the wire. A minified file can still benefit from HTTP compression.

Minification is not obfuscation

This tool does not rename variables or properties, remove dead code, or rewrite expressions. It makes source more compact, but it does not attempt to conceal how the program works.

Comments, strings, ASI, and source maps

Ordinary comments are removed while /*! */ license comments are retained. String and regular-expression contents are parsed as literals rather than treated as minifiable whitespace. The printer preserves token boundaries and statement semantics around automatic semicolon insertion. This lightweight tool does not generate source maps, so use a build pipeline when you need mappings back to original source locations.

Frequently asked questions

Does this JavaScript minifier execute my code?
No. The parser reads source as text; nothing is evaluated.
Does minification change what my program does?
No. Only whitespace and comments are removed. Output is re-parsed and structurally compared against the input AST.
Does it rename my variables?
No. Variable and property renaming require scope analysis; this minifier never renames.
Does it remove comments?
Ordinary comments are removed. /*! */ license comments are preserved.

Related tools