Paste JavaScript to get a smaller file that loads faster, minified by Terser.
Loading the tool…
What minifying does
| Step | Example |
|---|---|
| Removes whitespace and comments | Indents, line breaks and // notes go |
| Shortens local names (mangle) | basket becomes a |
| Simplifies code | if/else may become a ? b : c |
| Drops console.log (optional) | Debug output is removed |
Minified JavaScript is often 30% to 60% smaller. With gzip or Brotli on your server, pages load faster, especially on mobile.
Good practice
- Keep your original file for editing; minified code is hard to read.
- Licence comments starting with /*! or containing @license are kept.
- Test your site after replacing a file.
- Modern JavaScript (ES2015 and later) is supported.
Frequently asked questions
Is minified JavaScript safe?
Yes. Terser is used by most modern build tools and keeps your code’s behaviour the same.
Why did I get a syntax error?
The minifier must understand your code, so fix the error at the line and column shown first.
Can I unminify JavaScript?
You can reformat it, but the original names and comments can’t be recovered.
Is my code uploaded?
No, it’s minified in your browser.
Sources
Last updated: