JavaScript Minifier

Reduce JS file size by removing comments and collapsing whitespace. See exact bytes saved.

How to use

  • Paste your JavaScript code into the input box above.
  • Choose which minification options to apply using the checkboxes.
  • Click Minify JavaScript to compress your code.
  • View the original size, minified size, reduction percentage, and bytes saved.
  • Copy the minified output or download it as a .js file.
  • For maximum safety, keep all options checked — this tool only removes whitespace and comments.

About this JavaScript Minifier

Minification strips a script down to the smallest file size that still runs identically — removing comments, unnecessary whitespace, and line breaks — which reduces how much data a browser has to download before the page can run.

What minification actually removes

  • Comments, which have zero effect on how the code executes
  • Extra whitespace and line breaks used purely for human readability
  • Unnecessary semicolons and redundant syntax

More advanced minifiers also rename local variables to shorter names (like turning "userAccountBalance" into "a"), which saves additional bytes since variable names only need to be consistent within their own scope, not meaningful to a reader.

Why keep an unminified version too

Minified code is functionally identical but nearly unreadable for debugging — error messages point to line 1, character 48,203 instead of a meaningful location. The standard practice is developing and editing readable source code, then generating a minified version specifically for production deployment.

Minification vs. compression

Minification is a separate step from server-level compression (like gzip or Brotli), which further compresses the already-minified file for transfer over the network. Sites typically use both together: minify the source first, then let the server compress it during delivery for the smallest possible transfer size.