JavaScript Minifier Online - Free JS Compression Tool

Minify JavaScript for production. Fast, secure, and completely free. All processing happens in your browser — no data is sent to any server.

What is a JavaScript Minifier?

A JavaScript Minifier removes everything from your source code that a JS engine doesn't need to execute it correctly: comments, unnecessary whitespace, and line breaks, while leaving the actual logic — variable references, function calls, control flow — intact. This is the same category of transformation performed by build tools like Terser or UglifyJS, though this tool focuses purely on whitespace and comment removal rather than aggressive variable-renaming or dead-code elimination, so the output stays predictable and easy to reason about if something needs debugging later.

How to Use JavaScript Minifier

  1. Paste your JavaScript source code into the input panel
  2. Click 'Minify' to strip comments, indentation, and unnecessary line breaks
  3. Check the size comparison to see the byte reduction achieved
  4. Copy the minified output for use in a quick script tag, snippet, or embed
  5. Keep your original, formatted source as the source of truth — minified output isn't meant to be edited directly

Key Features

Why Use JavaScript Minifier?

When you need to embed a small script directly in an HTML page, a bookmarklet, or a quick browser console snippet, every extra character matters — bookmarklets in particular are often limited by URL length. Minifying strips the readability overhead you don't need in that context while keeping variable names intact, which makes the output far easier to debug than the output of an aggressive production bundler if something doesn't behave as expected.

Common Use Cases

Frequently Asked Questions

Does minifying rename my variables like a production bundler would?

No — this tool only removes whitespace and comments. Variable and function names stay exactly as you wrote them, which keeps the output readable enough to debug directly.

Is this a replacement for a full build tool like Webpack or esbuild?

Not for production apps — those tools also handle bundling, tree-shaking, and more aggressive optimizations. This tool is best for quick, standalone snippets rather than a full application build pipeline.

Will minifying break my code if it relies on specific line numbers, like in stack traces?

Yes, potentially — collapsing multiple lines into one changes what a stack trace reports. Keep your unminified source for debugging and only ship the minified version.

Does it support modern syntax like async/await and optional chaining?

Yes, modern ES2017+ syntax is preserved and minified correctly.

Can I minify JSON that's embedded inside JS as an object literal?

Yes, object literals inside your JS are minified along with the rest of the code, just like any other part of the script.

Guides

Related Tools