⚡ JavaScript Minifier

JavaScript Minifier

Minify JavaScript with Terser — compress, mangle names, and remove dead code. Paste code or upload .js files and see exact bytes saved. Batch mode and beautify included, 100% in your browser.

Input
Output

Why Minify JavaScript? Less to Download, Parse, and Run

JavaScript is expensive twice over: the browser must download it and then parse and execute it before your app becomes interactive. A JavaScript minifier attacks both costs by removing comments and whitespace, dropping dead code, and mangling local names. This tool uses Terser, the same AST-based engine bundlers rely on, so compression is safe — the minified script behaves identically to your source.

Smaller scripts reduce Total Blocking Time and speed up Largest Contentful Paint, both of which feed Google's Core Web Vitals ranking signals. Minification routinely cuts JS size 30–60% before your server even applies gzip or Brotli on top.

Keep Source Readable, Ship Minified

Edit and review the readable version in source control; generate the minified build for production. If you need to inspect a minified script, switch to Beautify mode to re-expand it (note that mangled names cannot be restored — beautify only fixes formatting). Round out your build by minifying styles and markup with the CSS Minifier and HTML Minifier, or use the Minify Tools hub for all of them.

Frequently Asked Questions

What does a JavaScript minifier do?

A JavaScript minifier shrinks your code by removing comments, whitespace, and dead code, and by shortening (mangling) local variable and function names. This tool uses Terser, the standard minifier behind modern bundlers, which parses your JavaScript into an abstract syntax tree so it can compress safely — the minified output behaves exactly like the original, just smaller.

Is minified JavaScript safe to run in production?

Yes — minification with Terser is a standard production build step used by virtually every major site. It only mangles local names inside your code; global identifiers and public API names are preserved so nothing external breaks. If Terser cannot parse your input (a syntax error), the tool reports the error instead of producing broken output.

What is name mangling and will it break my code?

Mangling renames local variables and function parameters to short names like a, b, c to save bytes. It is scope-aware, so it never renames anything that would change behaviour — properties accessed by string, globals, and exported names are left alone. The result runs identically; only the internal names a human would read are shortened.

Can I minify several JavaScript files at once?

Yes. Use the batch tab to add multiple .js files; each is minified locally with Terser and the tool shows per-file and total savings. Because everything runs in your browser, your source code is never uploaded — safe for proprietary or unreleased code.

How much smaller does JavaScript get, and does it help performance?

Minification alone typically cuts JavaScript size by 30–60%, depending on how much it can mangle and remove. Smaller scripts download faster and parse/execute sooner, reducing Total Blocking Time and improving Largest Contentful Paint — Core Web Vitals that affect Google rankings. Serving the minified file with gzip or Brotli compounds the savings.