Minify JavaScript code in your browser. Compare file sizes, validate syntax and copy or download the compressed result.
Free, runs entirely in your browser — no sign-up, no file upload to a server.
What does JavaScript Minifier do?
It compresses real JavaScript using terser's actual parser and compressor — removing whitespace and comments, shortening local variable names, and rewriting expressions to a shorter equivalent form — not a regex that blindly strips characters.
Is my code sent to a server?
No — minification runs entirely in your browser, in a background Web Worker so the page stays responsive. Your code is never uploaded anywhere and never executed, only parsed and transformed as text.
Will minifying ever change what my code does?
Minification aims to be semantically equivalent, but it isn't a guarantee for every possible program. Code that depends on its own exact source text (for example via Function.prototype.toString()), or on behavior outside the JavaScript spec, can behave differently once minified. Mangling only renames local variables and functions — never object properties or global names — since that's the change most likely to break code relying on a public API.
What happens to comments?
By default, ordinary comments are removed while comments terser recognizes as a license/legal notice (starting with "!" or containing @license/@preserve) are kept. Both behaviors are adjustable in the options.
What do the byte counts mean?
They're the UTF-8 byte size of the raw text, before and after minifying — not an estimate of what a browser actually transfers after gzip or Brotli compression, which is usually smaller than either number shown here.
How do I report a problem or request a feature for this tool?
Use the Contact / Feedback page — select "JavaScript Minifier" as the related tool so we know exactly which tool you mean, then describe the bug or the feature you'd like to see.