JavaScript Minifier

Compress JavaScript safely โ€” comments stripped, strings protected, whitespace collapsed.

The JavaScript Minifier removes single-line and block comments using a string-aware state machine that never touches text inside quotes, then collapses redundant whitespace conservatively so your code keeps working. It reports the original size, minified size and percentage saved. Use it to shrink scripts before deployment while keeping the logic byte-for-byte equivalent.

0
Original (bytes)
0
Minified (bytes)
0%
Saved
Minified JavaScript will appear here.
Advertisement

How to use the JavaScript Minifier

  1. Paste your JavaScript code into the text box at the top.
  2. Click Minify JS โ€” comments are removed with a string-aware parser and whitespace is collapsed conservatively.
  3. Check the size statistics, then use Copy Result to copy the minified code.

JavaScript Minifier โ€” FAQs

Is the JavaScript minifier free?

Yes, completely free with no signup and no limits. Minify as many scripts as you need, any time, directly in your browser, making it perfect for quick pre-deployment compression of scripts large and small alike.

Will minified code still run correctly?

The minifier is deliberately conservative: it removes comments and collapses whitespace but never renames variables or restructures logic. A state machine protects string literals so comment-like text inside quotes is preserved. Always test minified code before deploying.

Is my code uploaded to a server?

No. Minification happens entirely in your browser with JavaScript, so your source code never leaves your device. It is safe for proprietary scripts, client projects and confidential business logic that must never be shared with outside services.

Does it handle template literals and escaped quotes?

Yes. The parser tracks single quotes, double quotes and backtick template literals, and respects backslash escapes, so text that looks like a comment inside a string is never stripped or altered, keeping string contents exactly as you wrote them.

Related tools

Advertisement