JS

JavaScript Minifier

Minify JavaScript to reduce file size and improve page performance. Free, instant.

💻 Developer Tools Free Browser-based
Tool

What is JavaScript Minification?

JavaScript minification is the process of removing all characters from JS source code that are not needed for execution — comments, indentation, extra spaces and blank lines. The resulting file is functionally identical to the original: it runs the same code and produces the same behaviour, but is significantly smaller, meaning it downloads faster and parses faster in the browser.

Minification is one of the most reliable ways to reduce JavaScript bundle size without changing a single line of logic.

What This Minifier Does

  • Removes single-line comments — everything from // to end-of-line is stripped (comments inside strings are preserved).
  • Removes multi-line comments — everything between /* and */ is stripped.
  • Collapses whitespace — multiple spaces, tabs and newlines are collapsed where safe, including around operators.
  • Preserves string literals — content inside single quotes, double quotes and template literals is left exactly as written.

Basic vs Full Minification

FeatureBasic (this tool)Full (Terser / esbuild)
Remove commentsYesYes
Collapse whitespaceYesYes
Rename local variablesNoYes
Dead-code eliminationNoYes
Inline constantsNoYes
Typical size savings10–30%40–65%
Safe for any JS?YesNeeds config

Use this tool for one-off snippets, third-party scripts you can't rebuild, or quick checks. Use Terser or esbuild in your build pipeline for production bundles.

How Much File Size Can You Save?

Savings vary by how much commentary and formatting the original file contains:

  • Lightly commented code — 10–15% saving from whitespace removal alone.
  • Heavily commented library code — 25–35% saving.
  • Full AST minification (Terser with mangle) — 40–65% saving.
  • With Gzip on top — total transfer reduction of 70–85% compared to original uncompressed source.

When NOT to Minify

Avoid minifying during local development — minified code is hard to debug and DevTools stack traces become unhelpful. Always keep your original source files and minify only as a build step before deploying. If you need to debug minified production code, use source maps (.map files) which link minified line numbers back to original source.

Minification and SEO

JavaScript file size affects page speed, and page speed is a confirmed Google ranking factor. Smaller JS files mean faster parse times, lower Total Blocking Time (TBT), and better INP scores — all of which feed directly into Core Web Vitals. Minifying your JS is one of the fastest ways to improve these scores without architectural changes.

Frequently Asked Questions