110 · Developer Tools

JavaScript Minifier

Paste JavaScript to get a smaller version that behaves the same. Minification runs on your device with Terser.

JavaScript Minifier

How to use the javascript minifier

  1. Paste your JavaScript.
  2. Choose whether to shorten names and simplify code.
  3. Copy the minified code.

What the options do

  • Shorten variable names (mangle): renames local variables to single letters. Global names stay the same.
  • Simplify code (compress): removes dead code and rewrites expressions more compactly.
  • Keep licence comments: keeps comments with @license or starting with /*!.

Examples

function add(first, second) { const total = first + second; return total; }

function add(n,d){return n+d}

Code with a missing bracket

An error with the line and column

Questions

Does it support modern JavaScript?

Yes. Terser understands current JavaScript, including modules, classes, async functions and optional chaining.

Is my code uploaded?

No. Terser runs in your browser; your code never leaves your device.