JS Minify Tool
Minify JavaScript with real variable renaming and dead-code removal, live as you type.
Minified with Terser (real minification — renamed variables, removed whitespace/comments, shortened where safe), live as you type. Runs entirely in your browser; nothing you type is sent anywhere.
Need the opposite? JavaScript Obfuscator
What is JS Minify Tool?
Paste JavaScript and get it minified instantly using Terser, the same production-grade minifier used by major build tools. Real minification (shortened variable names, removed whitespace and comments, dead-code elimination), not just a whitespace strip.
How to Use JS Minify
- 1
Paste the JavaScript: Enter the source code you want to shrink.
- 2
Read the Minified Result Instantly: The minified output appears automatically as you type.
- 3
Copy the Result: Use the copy button to copy the minified code for production.
How It Works
Terser parses the code into an AST and applies several transforms: local variable and function names are renamed to short single/double-letter identifiers where it's safe to do so (names visible outside the scope, like exported functions or global references, are left alone), all whitespace and comments are removed, code that can never execute (like an `if (false)` branch or code after a `return`) is eliminated, and simple constant expressions are folded (e.g. `2 * 60` becomes `120`).
Example
function calculateTotal(price, quantity) {
// apply the quantity multiplier
const total = price * quantity;
return total;
}function calculateTotal(t,a){return t*a}The comment, whitespace, and the intermediate `total` variable are gone, and the parameters are renamed to single letters.
Common Use Cases
Shrinking a JavaScript file before shipping it to production, reducing the bytes a browser has to download and parse.
Compressing a script meant to be pasted inline into a `<script>` tag or a size-constrained embed.
Frequently Asked Questions
Common questions about JS Minify Tool.