JavaScript Minifier

Minify and compress JavaScript code online. Remove whitespace, comments, and shorten variable names to reduce JS bundle size and improve load time.

Used 46.9K times today

How to Use JavaScript Minifier

  1. 1

    Paste your JavaScript

    Copy your JS source code or a script snippet and paste it into the input area.

  2. 2

    Minify the code

    Click "Minify" to compress the code by removing whitespace, comments, and optionally mangling variable names.

  3. 3

    Copy the minified output

    Copy the compressed JavaScript for deployment in your production web application.

Frequently Asked Questions

Will minification break my JavaScript?
Whitespace and comment removal never breaks code. Variable name mangling (shortening long names) can cause issues if your code relies on function.name or if you are using certain eval patterns. Test minified output before deploying.
What is the difference between minification and obfuscation?
Minification reduces file size by removing unnecessary characters. Obfuscation deliberately makes code hard to read by renaming variables to meaningless names. This tool performs minification, which has the side effect of light obfuscation.
Should I minify third-party libraries?
Most popular libraries (React, lodash, etc.) already distribute minified versions. Only minify your own source code that is not yet minified.

About JavaScript Minifier

The JavaScript Minifier compresses JS files by removing comments, whitespace, and redundant code to produce the smallest possible script. Smaller JavaScript bundles mean faster downloads, quicker parse times, and better Lighthouse performance scores. This is a standard step in any web production deployment workflow.

While a full bundler like webpack or esbuild is better for large projects, this tool is invaluable for quickly minifying individual scripts, utility functions, or bookmarklets without configuring a build system. The output is production-ready and can be dropped directly into a script tag or served as a .min.js file.

More Developer Tools Tools