JavaScript Minifier

Safely strip comments and indentation from JavaScript for smaller files.

Runs in your browser Free
Processed locally in your browser.

Safe JavaScript minification

The JavaScript Minifier processes your code with a tokenizer that understands strings, template literals and regular expressions. It removes comments and indentation without any transformation that could change the code's meaning.

ASI-safe

Line breaks are kept where they matter, so code written without semicolons still follows the automatic semicolon insertion (ASI) rules and behaves the same after minification.

When to use it

Ideal for small scripts, analytics snippets, bookmarklets and projects without a build process. For advanced compression that shortens variable names, use a build tool like Terser or esbuild. Processing happens in your browser.

How to use JavaScript Minifier

  1. Paste your JavaScript code.
  2. The minified output is produced.
  3. Test the code in your environment.
  4. Copy the result.

Why use this tool?

A quick minification with the lowest risk of breaking code; your source never reaches a server.

FAQ

Does it shorten variable names?

No. It's a safe whitespace-and-comments minifier; use a build tool such as Terser if you need name mangling.

Can I minify TypeScript?

Compile it to JavaScript first; type annotations aren't supported.

Are licence comments kept?

Comments are removed; add licence information back at the top of the minified file.

Related tools