How to use
- Paste your JavaScript.
- Choose whether to shorten variable names and keep license comments.
- Click Minify, or press Ctrl+Enter (⌘+Enter on Mac).
- Copy or download the minified file.
Options explained
- Shorten variable names
- Renames local variables and function parameters to single letters. Global names are kept so other scripts can still use them.
- Keep license comments
- Keeps comments that start with /*! or contain @license or @preserve, which many licenses require you to retain.
Examples
function add(first, second) {
// sum
return first + second;
}
minifies to function add(d,n){return d+n}.
Frequently asked questions
Is the minified code safe to use?
Terser only applies transformations that keep the behaviour of valid code. Code that relies on function names at run time (for example via Function.name) can behave differently when names are shortened; turn that option off in that case.
Does it support modern JavaScript?
Yes. Terser understands current syntax including classes, async functions, optional chaining and modules. It does not convert code for older browsers.
Is my code uploaded?
No. Terser runs in your browser.
Privacy
This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.