{ JS Minifier }

// compress and minify JavaScript instantly in the browser

Minify and compress JavaScript instantly in the browser. Removes comments, whitespace, and shortens variable names — with stats, diff view, and download. Free, no signup.

// OPTIONS
OUTPUT
JS INPUT
→
MIN OUTPUT
⚡

Minified output appears here

Paste JS and click Minify

HOW TO USE

  1. 01
    Paste JavaScript

    Paste any JavaScript — a single file, a snippet, or copied source — into the left editor. The character count and file size update instantly.

  2. 02
    Configure options

    Toggle comment removal, whitespace stripping, operator compression, and optional variable shortening. Enable "Diff" mode to see exactly what was removed.

  3. 03
    Copy or download

    Click "▶ Minify" or type and it minifies live. Copy the result or download as a .min.js file. The savings bar shows the size reduction at a glance.

FEATURES

Comment Removal Whitespace Strip Operator Compress Variable Shortening License Preserve Diff View Download .min.js Free & No Signup

USE CASES

  • 🔧 Reduce JS file size before deploying to production
  • 🔧 Minify inline scripts in HTML templates
  • 🔧 Compress third-party scripts you can't modify at source
  • 🔧 Quickly test how much a script can be compressed

WHAT IS THIS?

The JS Minifier compresses JavaScript by removing comments, unnecessary whitespace, and redundant characters — reducing file size without changing what the code does. All processing happens in the browser; your code never leaves your machine. The diff view highlights exactly what was stripped.

RELATED TOOLS

FREQUENTLY ASKED QUESTIONS

Is my JavaScript sent to a server?

No. All minification happens entirely in your browser using JavaScript string processing. Your code never leaves your machine — there is no upload, no server processing, and no logging. The tool works offline once the page is loaded.

Will minified JS still work correctly?

Yes, for correctly written JavaScript. Minification removes characters that are syntactically unnecessary — spaces, newlines, comments — but does not change the logic. The only operations that can break code are aggressive variable renaming (if a variable is accessed by string via eval) and removing certain comments relied upon by external tooling. The "Shorten local vars" option is the one most likely to cause issues and is disabled by default.

What does "Shorten local vars" do?

When enabled, local variable and function parameter names are shortened to single letters (a, b, c, …). This reduces file size further but can break code that uses eval(), arguments.callee, or that relies on variable names at runtime. It is disabled by default for safety — only enable it if you know your code doesn't use these patterns.

What are "license comments" and why keep them?

License comments are block comments starting with /*! (a bang after the slash). They typically contain copyright notices, license text (MIT, GPL, etc.), or author attribution. Many projects require these to be preserved even in minified builds for legal compliance. The "Keep license comments" toggle preserves these while stripping regular comments.

What is the difference between minification and obfuscation?

Minification removes unnecessary characters to reduce file size while keeping the code readable (though tightly packed). Obfuscation deliberately transforms the code to make it hard to understand — renaming variables to meaningless strings, inserting dead code, and encoding literals. This tool performs minification. Obfuscation is a separate operation that significantly increases file size and reduces performance.

What does the Diff view show?

The Diff view highlights the characters that were removed during minification — comments appear struck through in red, removed whitespace is shown as red gaps, and preserved code appears in normal text. It helps you verify exactly what the minifier touched and confirm no meaningful code was accidentally removed.

JS Minifier — Compress JavaScript Free, No Upload Required

JavaScript minification is one of the most effective front-end performance optimisations available. A typical unminified JavaScript file contains 20–40% whitespace and comments by volume — none of which the browser needs to execute the code. Removing these characters reduces parse time and network transfer size, improving Time to Interactive on every page load.

What Gets Removed

Minification vs Bundling

Minification reduces individual file size. Bundling combines multiple files into one, reducing HTTP requests. Both are part of a complete build pipeline — tools like Webpack, Rollup, and esbuild do both. This tool handles minification directly in the browser for cases where a full build pipeline is overkill: testing, one-off scripts, CMS snippets, and inline scripts.

☕