JS Minifier
Nén JavaScript bằng Terser, giảm dung lượng
JS Minifier
The JS Minifier tool compresses your JavaScript code using Terser — the industry-standard minifier that applies both name mangling and syntax compression to produce the smallest possible output. Minifying JavaScript reduces page load times, lowers bandwidth costs, and improves Core Web Vitals scores without changing runtime behavior. Paste your code, click Minify, and get a production-ready .min.js file in seconds.
Benefits
Running your JavaScript through Terser delivers measurable improvements over shipping raw source code:
- Reduces file size by 60–80% on average by stripping whitespace, comments, and dead code.
- Name mangling shortens variable and function identifiers to single characters, further shrinking output.
- Syntax compression rewrites verbose constructs into shorter equivalents without altering logic.
- Full ES6+ support means modern JavaScript — arrow functions, classes, destructuring — is minified correctly.
Use cases
This tool fits naturally into a range of development and deployment workflows:
- Preparing JavaScript assets for production deployments where a full build tool like Webpack or Vite is not in use.
- Quickly minifying inline scripts embedded in HTML pages to reduce document weight.
- Generating a minified version to upload to a CDN or serve from a static hosting provider.
- Spot-checking what Terser's output looks like before wiring it into an automated CI/CD pipeline.
How to use
No installation or account is required — the entire process runs in your browser:
- Paste your JavaScript source code into the input panel on the left.
- Choose your options: toggle mangle to shorten identifiers and compress to apply syntax optimizations.
- Click the Minify button — the minified output appears instantly in the right panel.
- Copy the result to your clipboard or download it as a
.min.jsfile.
Frequently asked questions
What is the difference between Terser and UglifyJS? Terser is a maintained fork of UglifyJS that adds full ES6+ parsing support, making it the correct choice for any modern JavaScript codebase.
Will mangling break my code? Not if your code does not rely on runtime property name lookups via dynamic strings; Terser only renames local variables and function parameters, leaving object keys and exported names untouched.
Can I minify already-minified code? You can, but the gains are negligible — the first minification pass already removes nearly all redundant characters, so a second pass produces almost no size reduction.
Is my code sent to a server? No, Terser runs entirely client-side in your browser using WebAssembly or the bundled JavaScript build, so your source code never leaves your machine.