Skip to main content

    JavaScript Minifier

    Minify JavaScript online — strip comments and whitespace to reduce bundle size.

    No signup. 100% private. Processed in your browser.

    Input JavaScript

    Minified Output

    Why Minify JavaScript?

    JavaScript is usually the biggest bottleneck in web performance. It has to be downloaded, parsed, compiled, and executed — all before your page becomes interactive. Every kilobyte counts. Minification strips the parts humans need (comments, whitespace, readable names) while keeping everything the browser needs.

    A typical JavaScript file shrinks 30-60% after minification. That's not just faster downloads — it's faster parsing too. V8 (Chrome's JS engine) parses minified code faster because there's less text to process. For mobile users on slow connections, the difference between 200KB and 100KB of JS can mean seconds of load time.

    This tool handles comment removal, whitespace collapsing, and basic operator spacing. For production use, build tools like Terser, esbuild, or SWC provide advanced optimisations like dead code elimination, tree shaking, and variable mangling.

    What Minification Removes

    ElementBeforeAfterSavings
    Comments// Calculate total /* Multi-line */(removed)10-30% of file typically
    WhitespaceIndentation, blank linesCollapsed to minimum15-25% of file
    Line breaksOne statement per lineEverything on fewer lines5-10% of file
    Variable names*calculateTotalPriceaSignificant for large files
    Dead code*Unreachable branches(removed)Varies widely

    What this means for you: Items marked with * require advanced AST-based minifiers (Terser, esbuild). This online tool handles comments and whitespace — the quick wins that don't risk changing behaviour. Use it for one-off jobs; use build tools for production.

    JavaScript Minifier Comparison

    ToolSpeedCompressionBest For
    TerserModerateExcellent (AST-based)Webpack/Vite production builds
    esbuildVery fast (Go)Very goodSpeed-critical CI/CD pipelines
    SWCVery fast (Rust)Very goodNext.js, modern frameworks
    UglifyJSSlowGood (ES5 only)Legacy projects
    Google ClosureSlowBest (advanced mode)Maximum compression, type-aware

    Real-World Size Savings

    LibraryOriginalMinifiedMinified + Gzip
    jQuery 3.7282 KB87 KB (69%)30 KB
    React 18140 KB45 KB (68%)14 KB
    Lodash544 KB71 KB (87%)25 KB
    Three.js1.2 MB650 KB (46%)170 KB
    Typical app bundle500 KB200 KB (60%)65 KB

    Minification alone cuts 50-70%. Add Gzip/Brotli compression (which your server should already enable) and you're typically looking at 85-90% total reduction. That 500 KB bundle becomes 65 KB over the wire.

    Related Tools

    How to use this tool

    1

    Paste your JavaScript into the input area

    2

    Click Minify JavaScript to compress

    3

    Copy the result or download as a .min.js file

    Common uses

    • Reducing JavaScript file size for production
    • Stripping comments from code before deployment
    • Quick minification for inline scripts
    • Comparing file sizes before and after compression

    Share this tool

    Frequently Asked Questions