⚡
usefultools.dev
JS

JavaScript Minifier

NOUVEAU

Minify JavaScript with Terser: compress and mangle code, see the size saved, and copy or download the result.

Fonctionne à 100 % dans votre navigateur — vos données ne sont jamais envoyées ni stockées sur nos serveurs.

Cet outil n'est pas encore entièrement traduit : une partie du texte est encore en anglais. L'outil lui-même fonctionne de la même façon dans toutes les langues.

611 B
Compress
Mangle names
Output
Language

Minification is only as safe as the code. Code that uses eval, new Function, fn.name or reads property or variable names from strings can break, and with Top-level scope on, global names used by other scripts or inline onclick handlers are renamed. Always test the minified file.

⚡

Exemples rapides

Des entrées typiques et les résultats produits par cet outil.

Mangle
function add(first, second) { return first + second; }
function add(n,d){return n+d}
Compress
const msg = "a" + "b";
const msg="ab";
Dead code
if (false) { run(); } start();
start();
Comments
/*! v1.0 MIT */ // note let a = 1;
/*! v1.0 MIT */ let a=1;
Error
let x = ;
Line 1, column 9: Unexpected token: punc (;)
📖

Présentation

This JavaScript minifier shrinks scripts with Terser, the same engine used by many build tools. It removes whitespace and comments, shortens local variable and function names, and simplifies expressions so the file downloads and parses faster.

Developers use it to compress a snippet, a bookmarklet or a legacy script without setting up a bundler. Choose compress passes, mangle and top-level options, an ECMAScript target (ES2015 to ES2022), ES module mode, which comments to keep and which names to preserve, and optionally generate a source map.

Everything runs in your browser. Your code is never uploaded, and you see the original size, minified size, percentage saved and a gzip estimate right away.

Pourquoi utiliser cet outil ?

  • Smaller scripts with real Terser compression
  • Keep license comments, drop console calls
  • Source map output for easy debugging
  • Shows exact size and gzip savings
  • Private: code never leaves your browser
⭐

Fonctionnalités

🗜️

Compress and mangle

Inline code, remove dead branches and rename local variables, with 1 to 3 compress passes.

🧰

Fine-grained options

Drop console and debugger, keep function or class names, and protect specific identifiers.

🎯

ES target and modules

Pick ES2015, ES2017, ES2020 or ES2022 output and switch on ES module mode.

🗺️

Source maps

Generate a .map file and a sourceMappingURL comment so minified code stays debuggable.

📊

Size report

Original and minified bytes, percent saved and a gzip estimate for both.

📂

Upload and download

Drop a .js file in, then copy the result or download it as .min.js.

🛠️

Mode d'emploi

1

Add your code

Paste JavaScript into the input box, drop a .js file onto it, or press Sample.

2

Set the options

Tick Compress and Mangle, choose the comments to keep, the ECMAScript target and ES module mode.

3

Minify

Press Minify, or leave Minify as I type on. Check the size saved and any syntax error with its line and column.

4

Copy or download

Press Copy or Download .min.js, and download the .map file if you generated a source map.

🤔

Questions fréquentes