JS Minifier

Minify JavaScript to reduce file size. Removes comments, whitespace and newlines.

Input JavaScript
Minified JS

      

About the JavaScript Minifier

This free online JavaScript minifier removes comments, collapses whitespace, and strips unnecessary newlines to produce compact JS files that load faster in the browser. Reducing JavaScript file size directly improves Time to Interactive (TTI) and Largest Contentful Paint (LCP) metrics, which are key ranking signals in Google Search. The tool runs entirely in your browser and displays the exact byte savings after each minification.

Common use cases

Frequently Asked Questions

What does a JavaScript minifier do?

A JavaScript minifier reduces JS file size by removing whitespace, comments, newlines and unnecessary semicolons. More advanced minifiers (like Terser or UglifyJS) also shorten variable names, eliminate dead code and inline small functions. Smaller JS files download faster, parse faster and improve Time to Interactive (TTI) and Largest Contentful Paint (LCP) - two critical Core Web Vitals metrics.

How much can JavaScript minification reduce file size?

Basic minification (removing whitespace and comments) typically reduces file size by 20-40%. Combined with gzip or Brotli compression on the server, total transfer size reductions of 60-80% are common. For a 100 KB JS file, that can mean serving only 20-30 KB over the network, significantly improving page load speed especially on mobile connections.

Can minified JavaScript be reversed back to readable code?

Basic whitespace minification can be reversed using a JavaScript beautifier (available at ziptools.io/tools/js-beautifier). However, if variable names have been mangled by an advanced minifier like Terser, it cannot be fully reversed - the logic is preserved but original variable and function names are permanently lost. Use a source map in development to map minified code back to the original.

Should I minify JavaScript manually or use a build tool?

For production projects, a build tool like Webpack, Vite, Rollup or esbuild is recommended - they minify automatically on every build, generate source maps and integrate into your workflow. This online JavaScript minifier is ideal for quick one-off tasks: minifying a small script, compressing a bookmarklet, checking how much a snippet compresses, or working without a local build environment.

Is my JavaScript code safe when using this online minifier?

Yes. This free JavaScript minifier runs entirely in your browser - your code is never uploaded to or processed on any server. It is safe to use with proprietary code, API integrations, internal tools or client work.