Compress JS for production using Terser, or beautify minified code for inspection.
This tool uses Terser, the standard minifier for ES2015+ JavaScript (the successor to UglifyJS). Minification removes whitespace and comments, shortens variable names ("mangling"), inlines small functions, and removes dead code. A typical reduction is 30–60% of the original size.
Yes for production — they leak debugging info and slow down hot paths slightly. Keep them disabled in dev builds.
Minifying JavaScript matters most whenever a script gets shipped to real users, since every extra kilobyte adds to parse time and download time, especially on mobile connections. Developers without a full bundler setup — a plain HTML page with a few vendor-free scripts, a WordPress site with custom JS, or a browser extension — often minify manually before deployment rather than setting up webpack or Vite for a small project. It's also useful for quickly obscuring implementation details in client-side code, though mangling variable names is not a substitute for real security when logic genuinely needs to stay private. On the flip side, this tool works just as well in reverse: pasting in someone else's minified script to beautify it back into readable form is often the fastest way to understand a bug in a third-party library or to debug production code in browser devtools where the shipped file is a single unreadable line. A practical tip — always keep an unminified source copy under version control and treat minified output as a build artifact, since debugging directly against mangled variable names is painful even with source maps. Static site builders and browser extension developers shipping a handful of standalone scripts without a full bundler lean on a tool like this the most, since setting up Terser as a dependency for two or three files is often more overhead than the minification itself is worth.
Want more detail? Read How to Use JavaScript Minifier: Practical Guide and Best Practices.