Input

Minified Output

What Is the JavaScript Minifier?

Every kilobyte you shave off your JavaScript bundle means a faster page load — and web.dev performance guidelines and Google PageSpeed Insights will notice. This minifier strips whitespace, comments, and unnecessary tokens from your JavaScript code instantly. The ECMAScript specification defines the language; minification preserves runtime behavior while shrinking output. In production build pipelines, tools like Terser and UglifyJS handle this automatically — but when you need a quick one-off minification without a build setup, this tool does it right in your browser.

The minifier is JavaScript running on this page, so your source code is never uploaded while it gets squeezed down. Paste a script or open a .js file and the compact version appears alongside it. For formatting (the reverse), use JavaScript Formatter. For validation, use JavaScript Validator. For stronger protection, use JavaScript Obfuscator.

How to Use This Tool

1

Paste or Upload

Drop your script into the left panel, or open a .js or .txt file with Upload. Sample fills in a small block of code to try, and Clear empties both panels.

2

View Minified Output

Minified output appears on the right with comments and spare whitespace stripped out. If the script does not parse, you get an error message instead of broken output.

3

Grab the Minified Script

Take the compact script with Copy or save it with Download. If it is headed for production, let your server gzip or brotli-compress it as well, since that saves far more bytes on top.

JavaScript Minifier Examples

Here is an example of minifying formatted JavaScript code.

Example: API fetch function

Formatted input:

Input

Minified output:

Output

When the JavaScript Minifier Helps

When preparing production bundles with webpack or rollup, reducing bandwidth, or optimizing load times, minification shrinks JS files. Use with build tools or manually for quick checks. For obfuscation (harder to reverse), use JavaScript Obfuscator.

Frequently Asked Questions

Is my data private?

Yes. Your JavaScript is shrunk by code running in this tab, and none of it is posted to a server, so proprietary source is fine to paste.

Minifier vs Obfuscator?

Minifier shrinks code for size. Obfuscator makes code harder to read and reverse-engineer. Obfuscation often includes minification.

Does it break my code?

Valid minification preserves behavior. Semicolon insertion and edge cases can cause issues; test the output.

What about source maps?

This tool does not generate source maps. For production builds with source maps, use webpack, rollup, or Vite. See MDN on source maps.

Can I unminify?

Use JavaScript Formatter to add indentation. It does not restore comments or original variable names.

Related Tools

ECMAScript. MDN JavaScript. Terser. webpack. rollup.