JavaScript Minifier

Trim comments and needless whitespace from JavaScript for a quick, safe size reduction.

JavaScript Minifier

This is a conservative, whitespace-and-comment minifier — it does not rename variables. For maximum compression use a build tool like Terser.

🔒 Nothing you enter is sent anywhere or stored. All processing happens in your browser.

How it works

Shipping less JavaScript means faster pages. This minifier gives you a quick, safe reduction by removing what the engine doesn't need to run your code: single-line and block comments, and redundant whitespace and blank lines. It's careful to leave the contents of strings and template literals untouched, so your code keeps working.

Paste your script, minify, and see the original size, minified size, and percentage saved. Copy the compact version straight into a page or a quick experiment.

Deliberately conservative, it does not rename variables or restructure code — so there's far less risk of breakage than an aggressive optimiser. For production bundles where every byte counts, a full tool like Terser or esbuild in your build pipeline will compress further. Everything here runs locally; your code is never uploaded.

Examples

A commented function → the same function with comments and blank lines gone.
Strings like "a // b" are preserved exactly, not treated as comments.
Quick snippet for a demo → paste, minify, copy.

Frequently asked questions

Is it safe — will my code still work?
It's conservative: it removes comments and whitespace but leaves strings, templates and identifiers intact, so the behaviour is unchanged.
Does it rename variables to save more?
No. Variable renaming and advanced compression are left to dedicated build tools like Terser, which can go much further.
Why doesn't it save as much as my bundler?
Bundlers apply aggressive transforms; this is a lightweight, low-risk minifier meant for quick use.
Is my code uploaded?
No — everything runs in your browser.