JavaScript Minifier
Compress JS files.
JavaScript Minifier at a glance
JavaScript Minifier is a free online developer tool you can use right now to compress JS files โ no account, no install and no usage limit. It runs entirely inside your browser, so whatever you enter stays on your own device.
- Price
- Free โ no trial, no paid tier, no watermark
- Sign-up
- Not required
- Where it runs
- In your browser โ nothing is uploaded to a server
- Works on
- Chrome, Safari, Firefox and Edge โ desktop, tablet and phone
- Category
- Developer Tools
โ ๏ธ Basic minifier โ strips comments & whitespace. For production use a real bundler (esbuild, terser).
About JavaScript Minifier
Remove comments and unnecessary whitespace from JavaScript to reduce the bytes a browser has to download.
JavaScript size matters more than CSS size, and for a reason worth understanding. A stylesheet is parsed and applied; a script must be downloaded, parsed, compiled and executed, and all of that happens on the main thread. On a mid-range phone, parse and compile time for a large bundle is frequently a bigger cost than the download itself. Reducing bytes reduces every stage.
This tool performs safe minification โ stripping comments and whitespace. Production build tools go considerably further: renaming local variables to single letters, eliminating unreachable code, and tree-shaking unused exports out of the bundle entirely. Those transformations need full scope analysis to stay correct, which is why they belong in a build pipeline rather than a paste box.
Two practical cautions. First, minified code is unreadable in a stack trace, so generate source maps in your build if you want usable production errors. Second, if a minified script behaves differently from the original, the usual cause is code relying on something minification does not preserve โ most often reading a function's .name, or depending on automatic semicolon insertion where a missing semicolon was doing real work.
How to use JavaScript Minifier
- Paste your JavaScript into the box.
- Comments and unnecessary whitespace are removed automatically.
- Copy the minified output for production use.
Frequently asked questions
Does this rename variables like a build tool?
No. It performs safe minification โ comments and whitespace only. Variable renaming and dead-code elimination require full scope analysis to remain correct, which is a job for a build-step minifier such as esbuild, terser or SWC.
Why does minified JavaScript matter more than minified CSS?
Because scripts must be parsed, compiled and executed on the main thread, not just downloaded. On mid-range phones that processing often costs more than the download. Fewer bytes reduces every stage of the cost.
My code broke after minifying โ why?
Usually a dependency on something minification does not preserve. Reading a function's .name breaks if names change. Code relying on automatic semicolon insertion can change meaning when lines are joined. Adding explicit semicolons resolves most such cases.
Is my code uploaded anywhere?
No. Minification runs entirely in your browser, so proprietary or unreleased source stays on your device.