Home JS Minifier

JS Minifier

Shrink your JavaScript by removing comments, whitespace and redundant characters — with live size stats, copy and download, 100% in your browser.

Input JS

Output

Original
Minified
Saved

What is JavaScript minification?

JavaScript minification is the process of removing unnecessary characters from source code without changing its runtime behaviour. The minifier strips comments, whitespace, line breaks and other redundant bytes, producing a functionally identical script that is significantly smaller. A typical minified JS file is 40–60% smaller than its original, well-formatted source, and even smaller after gzip.

Because the minified code is parsed and executed exactly the same way by the JavaScript engine, the application's behaviour is unchanged — only the file size, parse time and transfer time improve. This makes minification a safe, high-impact optimisation that every production website should apply.

Why minify JavaScript?

Minifying JavaScript delivers concrete benefits for production websites. Smaller files download faster over the network, which is especially valuable on mobile connections and for users with limited data plans. The browser parses the script more quickly, reducing the time before the page becomes interactive. Minified files also compress better with gzip and Brotli, amplifying savings at the transfer layer.

For a site with several large JavaScript bundles, the combined savings can be substantial — shaving hundreds of kilobytes or even megabytes from every page load. This improves Core Web Vitals scores such as First Contentful Paint, Largest Contentful Paint and Time to Interactive, which search engines use as ranking signals.

What gets removed during minification?

A JavaScript minifier removes several categories of non-functional content while preserving the script's behaviour:

  • Block comments/* ... */ blocks are stripped entirely.
  • Line comments// ... comments to end of line are removed.
  • Whitespace — leading, trailing and multiple consecutive spaces are collapsed or removed.
  • Line breaks — newlines and tabs are removed where they are not significant.
  • Redundant separators — spaces around operators and punctuation are removed where safe.
  • Trailing semicolons — the last semicolon before a closing brace or end of file may be removed.

This converter applies a safe, conservative set of these transformations. It does not rename variables, mangle identifiers or rewrite control flow, so the output remains easy to verify and debug. Strings, regular expressions and template literals are preserved.

When to minify JavaScript

Minification belongs at the end of your build pipeline, applied to the files you ship to production. The typical workflow is to write clean, well-commented JavaScript during development, then run a minifier as part of the deploy step. Common moments to minify include:

  • Production builds. Run minification automatically through Webpack, Vite, Rollup, esbuild or another bundler before publishing.
  • Quick one-off optimisation. Paste a hand-written script into this tool to get a smaller copy for a static site or embed.
  • Auditing third-party scripts. Minify a vendor script that ships unminified to reduce its footprint.
  • Bookmarklets and snippets. Minify a snippet before pasting it into a bookmark or shared snippet library.

Always keep the original, readable source as your source of truth — the minified version is a generated artefact, not something to edit by hand.

Minification vs compression

JavaScript minification and HTTP compression (gzip or Brotli) are complementary, not interchangeable. Minification removes redundant characters from the source text, while compression encodes the transferred bytes more efficiently. Applying both gives the smallest possible transfer size: minification first, then server-side compression on the response.

Even after gzip, a minified file is usually significantly smaller than an unminified one, because minification removes patterns that compression cannot fully eliminate (such as comments and structural whitespace). For best results, enable minification in your build tool and gzip/Brotli on your web server or CDN.

Is this JS minifier free?

Yes, completely free with no sign-up, no limits beyond your device's memory, and no upload — everything runs locally.

Will minification break my code?

No. This tool only removes characters that have no effect on how the JavaScript engine executes the script. The runtime behaviour is identical. Strings, regexes and template literals are preserved.

Does it rename variables or mangle code?

No. This tool performs safe whitespace and comment removal only. It does not rename identifiers or rewrite control flow, so output remains readable and easy to debug.

Should I minify JS during development?

No — keep readable JS while developing so you can debug easily. Minify only when building for production.

Are my scripts uploaded?

No. All processing is local. Your JavaScript never leaves your browser.