100% client-side, nothing ever leaves your browser
Minify JavaScript
Paste JavaScript and get a safely minified version, powered by Terser — the same production-grade minifier used by modern build tools.
How JavaScript minification works
Terser parses your code into a proper syntax tree, applies safe transformations, and generates compact output — entirely inside your browser.
Paste your JavaScript
Paste a script, module, or function — modern syntax like async/await and classes is supported.
Safe transformation
Terser removes comments and whitespace, and optionally shortens local variable names, without changing behavior.
Copy or download
Review the byte savings, then copy the minified code or download it as a file.
Privacy note: minification runs entirely in your browser using Terser loaded from a CDN. Your code is never uploaded, logged, or stored on a server.
Common uses
Shrinking a script for production
Reduce a hand-written or generated script's size before shipping it to a live site.
Embedding inline scripts
Compact a small script for inclusion directly inside an HTML page or email template.
Checking a script's real size
See how much of a file's footprint was just comments and formatting versus actual logic.
One-off minification without a build step
Minify a small snippet or bookmarklet without setting up a full bundler for a single file.
Frequently asked questions
Is this safe to use on real production code?
Yes. This tool uses Terser, the same JavaScript minifier used by Webpack, Vite, and other major build tools. It parses your code into a proper syntax tree rather than using find-and-replace, so behavior is preserved.
Does it rename variables?
Yes, by default local variable and function names are shortened (mangled) where it's safe to do so, which further reduces file size. Globally accessible names and property names are left untouched unless you explicitly configure otherwise.
What happens if my JavaScript has a syntax error?
Terser will report a parse error describing the line and issue it found, instead of silently producing broken output. Fix the reported syntax error and minification will proceed.
Is my code uploaded anywhere?
No. Minification runs entirely in your browser using Terser loaded from a CDN. Your JavaScript is never sent to a server.
Does minified code still work the same way?
Yes. Terser's transformations are designed to preserve program behavior. Comments and whitespace are removed and code is restructured for size, but the logic executes the same as the original.
Can I minify modern JavaScript with async/await or classes?
Yes. Terser supports modern ECMAScript syntax including async/await, classes, arrow functions, and optional chaining.
More tools
Additional utilities from the same toolkit. Mangling vs bundling vs obfuscation — what's the difference? Read the JavaScript Minification Guide →, or see the measured benchmark →