Minify JavaScript by removing comments and whitespace. See file size savings. Free, private, browser-based JS compressor. Free and privacy-first.
JavaScript minification removes unnecessary characters from JS source code — comments, whitespace, newlines, and redundant formatting — without changing the code's behavior. The result is a smaller file that executes identically to the original.
JavaScript is typically the largest and most performance-critical resource on a web page. Reducing its size directly improves load times, Time to Interactive (TTI), and Total Blocking Time (TBT).
This browser-based minifier performs safe, regex-based minification:
// are stripped/* */ is removedThis tool provides basic minification suitable for quick optimization and testing. Advanced minifiers like Terser add:
longVariableName with aThese advanced techniques require a full JavaScript parser (AST) and are typically handled by build tools like Webpack, Vite, or Rollup. This tool is ideal for quick, safe minification without a build pipeline.
JavaScript has a triple cost on web performance: download time (network), parse time (CPU), and execution time (CPU). Minification primarily reduces download time but also slightly reduces parse time since the parser has fewer characters to process.
Minify JavaScript before deploying to production. Keep source code formatted during development for readability and debugging. Source maps can bridge the gap, allowing you to debug production code using original source.
All minification happens locally in your browser. Your JavaScript code never leaves your device. Safely minify proprietary code, API integrations, and business logic.
Complete your optimization workflow with our HTML Minifier and CSS Minifier. Encode scripts for transport with Base64 Encoder.
This is a basic minifier that removes comments and whitespace. For production use with variable renaming, dead code elimination, and tree shaking, use tools like Terser, UglifyJS, or your build tool's built-in minifier.
The regex-based approach is conservative. However, edge cases with regex literals, template strings, or string values containing '//' may occasionally be affected. Always test minified code.
No. This tool only removes whitespace and comments. Variable renaming (mangling) requires a full JavaScript parser and is handled by tools like Terser.
Typically 15-35% for well-commented code. The savings come primarily from removing comments and collapsing whitespace.
Browse all free tools · Guides and tutorials · PDF tools · Developer tools · Text tools · SEO tools