Initializing, please wait a moment

Paste raw JavaScript into the editor below and click Minify - the tool strips whitespace, comments, and dead semicolons (plus default Terser variable mangling) so the bundle is production-ready. If Terser cannot parse the input the page falls back automatically to vkbeautify and then to a comment+whitespace regex strip, so you get an output rather than an error wall.

Original: kB
Compressed: kB (%)
Saving: kB (%)

When to reach for this JS minifier

Reach for this JavaScript minifier online when you want to ship a smaller bundle to production without changing how the code behaves. Paste your script into the input pane, click Minify, and the tool returns compressed JavaScript with whitespace, comments, and semicolon padding stripped out. The output is plain text you can drop straight into a bundle, an npm package step, or a one-off CI artifact, and because Terser shortens local identifiers while leaving exported names intact, the minified file keeps the same module API as your source. Everything runs in your browser tab with no account and nothing uploaded.

JS Minifier - Minify JavaScript Easily


JS Minifier shrinks a JavaScript file for production: paste your source, click Minify, and copy the smaller output. Terser runs locally in this browser tab, stripping whitespace and comments and shortening identifiers where that is safe, so the script loads faster for visitors on mobile and slower networks.

Always test your site or build after minifying to confirm behavior is unchanged.

Badge: minify JavaScript in your browser - paste and minify.

Minification and compression do different jobs

Minification and compression stack, and a production build wants both. Minification removes whitespace, shortens variable names, and drops dead code; compression (gzip, brotli) layers on top at the server and saves another 60-75% on wire size. Minified and brotli'd jQuery drops from 280 KB to roughly 30 KB on the wire.

The Minify button on this page handles the build-time pass; cold-start JS frameworks (Remix, Next.js) ship with minification enabled at build. Confirm brotli is on at your CDN edge - already the default on most CDNs, so check the Cloudflare, CloudFront, or Fastly edge settings - so the full saving lands on a cold-start request. For the byte-size threshold that changes a serverless cold-start from 1.2s to 400ms, when tree-shaking outperforms minification, and a source-map-aware build step, read How to minify CSS / JS for Cloud Run cold-start wins.


Pairing the minifier with the rest of a front-end build

Across a front-end build, JavaScript is seldom the only thing you shrink: pair this with the CSS minifier so the script and the stylesheet both ship at production weight from the same browser tab. When a minified bundle later lands on your desk for a bug hunt and the stack trace points at unreadable one-line code, the JavaScript unminifier restores the spacing and line breaks so you can actually follow the logic - the guide how to unminify JavaScript covers the common minified bundle shapes and the formatting options that make each readable again. Both tools, plus the rest of the format and hash set, sit on the developer tools hub.


Minifying proprietary or pre-release code

Closed-source bundles and unshipped features are safe to paste here: the pass reads only what you put in the editor and never transmits it, so the source never reaches a hosted service. The original-versus-minified size figures next to the output let you confirm how much you saved before you copy the result.


One-off minify now, automate with a CLI later

This minifier is built for the one-off pass, with no toolchain to install. When the same bundle needs shrinking on every commit, move the step into your build instead - a command-line minifier such as terser, esbuild, or swc plugs into the bundler and runs faster on large codebases than a manual paste. Reach for this page when you want a quick result without wiring up a pipeline.


What happens when Terser cannot parse, and why exported names survive

Terser does the compression here, but the tool keeps two fallbacks so a paste never fails outright: if Terser cannot parse an unusual bit of syntax, a regex pass still strips block and line comments and collapses whitespace, and a second pass through vkbeautify clears the remaining slack. The identifier-shortening stays deliberately conservative - names used only inside a function get shortened, but names you export are left untouched, so a module's public API keeps working after the pass. That is the practical reason a file other modules import from shrinks a little less than a self-contained script: its exported names cannot be renamed, only its internals. Comments are removed entirely, including any licence banner written as a comment, so keep a separate copy of a licence header your dependencies require you to ship.

Related tools:

Tags: #pagespeed, #minifier, #javascript, #developer

Related guides:

Loading reviews...

How to Use the JavaScript Minifier

Using the JavaScript minifier tool is quick and straightforward. Follow these steps to reduce your JavaScript file sizes:

  1. Paste Your JavaScript Code: Input your code into the provided box.
  2. Click "Minify": Initiate the minification process to compress the code.
  3. Copy the Minified Code: Use the compressed JavaScript in your project for improved performance.

Benefits of Using JavaScript Minification

Minifying JavaScript offers multiple advantages that enhance both user experience and site performance:

  • Improved Load Times: Faster page loads lead to better user engagement and experience.
  • Bandwidth Savings: Smaller file sizes reduce bandwidth consumption, saving costs for users and servers.
  • Enhanced SEO: Faster load times improve search rankings, increasing visibility on search engines.
  • Optimized Mobile Performance: Minified JavaScript files load more efficiently on mobile devices, especially on slower networks.

Frequently Asked Questions

What is JavaScript minification?

JavaScript minification is the process of compressing JavaScript files by removing extra characters, whitespace, and comments that do not impact code functionality, resulting in a smaller file size.

Does minifying JavaScript affect functionality?

No, minification preserves the functionality of your code while reducing its size, making it load faster without altering how it works.

Why should I minify JavaScript for production?

Minifying JavaScript enhances site performance by reducing file sizes, leading to faster load times and better user experience-both of which are important in production environments.

Is JavaScript minification reversible?

Minification is a one-way process, so it's best to keep a backup of your original code. You can use a source map to assist with debugging in production.

Is this JavaScript minifier free to use?

Yes, our JavaScript minifier is completely free and requires no installation or sign-up. You can compress your code instantly and as often as needed.


Best Practices for Minifying JavaScript Code

When minifying JavaScript, test the minified code across different browsers and devices to ensure full functionality before you ship it.

Conclusion: Optimize Your JavaScript for Better Performance

Minifying JavaScript is essential for optimizing website performance, reducing load times, and improving SEO. Use this free JavaScript minifier to create lean, efficient code for production environments.


and enhance your website's speed and performance with ease.