Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

JavaScript Minifier — Minify JS Online

Paste JavaScript and get production-ready minified code from Terser — the same engine used by Vite, webpack and Rollup — with real before/after and gzipped sizes.

Mis à jour le
Open file

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : JavaScript Minifier

  1. Paste your JavaScript or open a .js file.
  2. Keep Compress and Mangle names on for the smallest output; tick ES module for code with import/export.
  3. Optionally remove console calls and choose which comments to keep.
  4. Copy the result or download it as .min.js.

What does a JavaScript minifier do?

Minification makes JavaScript smaller without changing what it does. It removes whitespace and comments, shortens local variable and function names, and rewrites code into shorter equivalent forms. Smaller files download and parse faster, which helps page speed and Core Web Vitals — especially on mobile.

This tool runs Terser, the minifier behind Vite, webpack and Rollup, directly in your browser.

The main options

OptionWhat it doesRisk
CompressRemoves unreachable code, folds constants (60 * 60 → 3600), simplifies conditions and joins statementsVery low
Mangle namesRenames local variables and parameters to one or two lettersLow — code that uses eval or Function.name may break
Mangle top-levelAlso renames global functions and variablesBreaks code that other scripts call by name
ES moduleParses import/export and enables strict mode and top-level manglingNone for real modules
Remove console.*Drops console.log and similar callsRemoves logs you may want in production

Minification vs compression

Minification and gzip/Brotli work together. Minifying typically removes 30–60 % of a file; the server’s gzip or Brotli compression then shrinks what is left by another 60–70 %. The stats above show both: the minified size and the gzipped size that will actually travel over the network.

Keep license comments

Open-source licenses such as MIT require the copyright notice to stay with the code. By convention these comments start with /*! or contain @license, and the default setting keeps them.

Troubleshooting

  • Syntax error: the line and column are shown. TypeScript and JSX must be compiled to JavaScript first.
  • Code stops working after mangling: turn off Mangle top-level names; if that does not help, check for eval or code that reads function names.
  • Need a readable version again? Use the JavaScript formatter to beautify minified code.

Aussi recherché comme : minify js, js minifier, javascript compressor, uglify js online, terser online, compress javascript, minify es6.

Outils complémentaires : JavaScript Minifier

  • HTML Minifier — Shrink HTML pages and templates by removing comments and redundant whitespace, minifying inline <style> and <script>, and cleaning up attributes — while keeping the layout identical.
  • CSS Minifier — Paste a stylesheet to shrink it instantly.
  • JSON Minifier — Remove all unnecessary whitespace from JSON, validate it at the same time and see exactly how many bytes you save — before and after gzip.
  • Website Compression Test — Enter a URL to see which compression your server sends for each Accept-Encoding, how many bytes it saves, whether its CSS and JavaScript are compressed, and what Brotli could save.

Questions fréquentes

Is Terser better than UglifyJS?
Terser is a maintained fork of UglifyJS that understands modern JavaScript (ES2015+), including classes, arrow functions, async/await and modules. UglifyJS does not support all modern syntax.
Will minified code behave exactly the same?
Yes for normal code. Mangling can break code that relies on eval, with or function names at runtime; turn mangling off for such code.
Can it minify TypeScript or JSX?
No — compile TypeScript or JSX to plain JavaScript first (with tsc, esbuild or Babel), then minify the output.
Is my code uploaded?
No. Terser runs entirely in your browser; your source code never leaves your device.
How do I un-minify JavaScript?
Paste it into the JavaScript formatter. Formatting restores indentation and line breaks, but mangled variable names cannot be recovered without a source map.
Puis-je installer JavaScript Minifier en tant qu’application web et l’utiliser hors ligne ?
Oui. JavaScript Minifier est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires