Developer Tools
Live

JavaScript Minifier

Minify JavaScript by removing whitespace and comments.

Minify JavaScript by removing whitespace and comments.

Accepts:JSOutputs:JS
Quick start: Paste your JavaScript source into the input area. → Optionally enable name mangling to shorten local variable and function names. → Click Minify to remove whitespace and comments and apply any mangling.

Supported formats

Input formats
JS
Output formats
JS

How to use JavaScript Minifier

  1. 1

    Paste your JavaScript source into the input area.

  2. 2

    Optionally enable name mangling to shorten local variable and function names.

  3. 3

    Click Minify to remove whitespace and comments and apply any mangling.

  4. 4

    Review the original size, minified size, and percentage saved.

  5. 5

    Copy the compressed, production-ready JavaScript with one click.

Real examples of JavaScript Minifier in action

Whitespace and comments removed
Before
// add two numbers
function add(a, b) {
  return a + b;
}
After
function add(a,b){return a+b}
With name mangling enabled
Before
function greet(name) {
  const message = 'Hi ' + name;
  return message;
}
After
function greet(n){const m='Hi '+n;return m}
Popular tools

Try our most-used tools

Who is JavaScript Minifier for?

Developers shipping scripts without a bundler

Email and landing-page builders trimming inline JS

Engineers compressing third-party code provided unminified

Anyone preparing a small embed snippet for production

Why use JavaScript Minifier?

  • Strips whitespace and comments to cut JavaScript size, often 30 to 60 percent.
  • Optional name mangling shortens local identifiers for extra savings up to roughly 70 percent.
  • Leaves global names and exports untouched so external references keep working.
  • Shows original size, minified size, and exact percentage saved.
  • Runs in your browser, so proprietary source code is never uploaded.

Common use cases

  • Produce a quick production build of a script when no bundler is set up.
  • Minify an inline script for a landing page or email template.
  • Shrink a third-party utility that was only distributed unminified.
  • Compress a small embed snippet before pasting it into a CMS or page.

How JavaScript Minifier compares to alternatives

Honest comparison to other popular options — pick the right tool for the job.

ToolMain limitation
Terser / esbuildFar more capable with tree-shaking, but require a Node build setup and configuration
Online minifiers on ad-heavy sitesCluttered with ads and trackers, and many send your code to a server
Manual editingTedious and error-prone, and easy to break code by deleting the wrong whitespace
JavaScript MinifierFree, runs in your browser, no sign-up, no watermarks, no file-size limits beyond your device memory.

Limitations & things to know

  • Single-file minifier with no tree-shaking or cross-module dead-code elimination
  • Dynamic imports and some ES module constructs may not compress fully

About JavaScript Minifier

A JavaScript minifier compresses source code into the smallest equivalent form by removing whitespace and comments, and optionally renaming local variables to shorter identifiers. JavaScript is one of the heaviest resources on most pages, and because it has to be downloaded, parsed, and executed before the page becomes interactive, cutting its size directly improves load and interaction times. This tool strips spaces, line breaks, and comments, and offers an optional name-mangling pass that shortens local variable and function names to single characters for additional savings. Mangling is off by default and only touches local names; it deliberately leaves global names and exports alone so it does not break references that other scripts rely on. As a rough guide, whitespace and comment removal alone typically cuts 30 to 60 percent, and enabling mangling can push that to roughly 50 to 70 percent depending on how the code is structured. The tool displays the original size, the minified size, and the percentage saved. A few honest caveats. Minification preserves behavior, but it is not the same as the advanced dead-code elimination and tree-shaking that a bundler like esbuild, Terser, or Rollup performs across an entire dependency graph. This is a single-file, paste-and-go minifier, ideal when you need a quick production version of a script and do not have a build pipeline running. It supports ES6+ syntax including arrow functions, template literals, async and await, and modules, though some constructs such as dynamic imports may not compress as fully. Because it runs entirely in your browser, your source never leaves your device, which matters for proprietary code. For the reverse, the JavaScript Beautifier expands minified code back into readable form, although it cannot recover names that mangling already discarded.

Frequently asked questions

It should not for self-contained scripts, because only local names are shortened. Globals and exports are left intact. If other files reference your internal names by string, however, mangling can break those references.
No. Those run tree-shaking and dead-code elimination across an entire project. This is a single-file minifier for quick compression without a build pipeline.
Whitespace and comment removal alone is usually 30 to 60 percent. Turning on mangling can reach roughly 50 to 70 percent, depending on the code.
No. All minification runs in your browser. Your code stays on your device.

Your files never leave your device

Every tool on Xevon Tools runs 100% in your browser. No uploads, no servers, no tracking. Free forever.

Learn more

Embed JavaScript Minifier on your site

Add this tool to your own website, blog, or internal tool page with one line of code. Free to use, no attribution required (but appreciated).

<iframe src="https://www.xevontools.com/embed/minify-js" width="100%" height="640" style="border:1px solid #e2e8f0;border-radius:12px;" title="JavaScript Minifier — Xevon Tools"></iframe>
Share: