javascript JavaScript Minifier

Minify JavaScript code to reduce file size with compression stats and multiple optimization options

0 characters

tune Minification Options

upload_file Upload JavaScript File

Drag and drop or click to upload a .js file

cloud_upload

Drop JS file here or click to browse

quick_reference Minification Transformations

// comment
arrow_forward
(removed)
/* block */
arrow_forward
(removed)
true / false
arrow_forward
!0 / !1
undefined
arrow_forward
void 0
"string"
arrow_forward
'string'
console.log()
arrow_forward
(removed)*

* Only with "Remove console.* calls" enabled

About the JavaScript Minifier

Minify your JavaScript code instantly with our free online tool. JavaScript minification reduces file size by removing unnecessary characters like whitespace, comments, and line breaks without changing functionality. Smaller JS files mean faster page loads and improved performance.

What is JavaScript Minification?

JavaScript minification is the process of removing all unnecessary characters from JavaScript source code without changing its functionality. This includes whitespace, newlines, comments, and sometimes shortening variable names. The minified code runs exactly the same as the original but downloads faster.

Key Features

  • Whitespace Removal — Eliminates spaces, tabs, and newlines between statements
  • Comment Removal — Strips both single-line (//) and multi-line (/* */) comments
  • Boolean Shortening — Converts true to !0 and false to !1
  • Undefined Shortening — Converts undefined to void 0 (shorter and immutable)
  • Quote Normalization — Converts double quotes to single quotes for consistency
  • Console Removal — Option to strip all console.log, console.warn, etc. for production
  • Debugger Removal — Option to remove debugger statements
  • Compression Statistics — Shows original size, minified size, and savings percentage

Minification Presets

Preset Description Best For
Safe Only whitespace and comments removal When debugging with minified code
Default Standard optimizations (safe transforms only) Most development and staging
Production Maximum compression, removes console/debugger Production deployments

Why Minify JavaScript?

  • Faster Page Loads — Smaller files download quicker, improving Time to Interactive
  • Better SEO — Page speed is a Google ranking factor; faster sites rank higher
  • Reduced Bandwidth — Save server bandwidth and reduce hosting costs
  • Improved Core Web Vitals — Better LCP, FID, and INP scores
  • Lower Data Usage — Users on mobile data plans will thank you

Typical Compression Results

JavaScript minification typically achieves 30-60% size reduction depending on code style. Combined with gzip compression, total savings can reach 80-90%. For example:

  • Original JS: 100 KB
  • After minification: ~50 KB (50% savings)
  • After gzip: ~12 KB (88% total savings)

Important Notes

  • This tool performs basic minification — it does not rename variables or perform advanced optimizations
  • For production builds, consider using Terser, UglifyJS, or esbuild for more aggressive minification
  • Always test minified code before deploying to production
  • Keep source maps or original code for debugging

Privacy & Security

All JavaScript minification happens directly in your browser using JavaScript. Your code is never sent to any server, making this tool completely safe for proprietary or sensitive source code.