JS Minifier

Minify JavaScript code

About JS Minifier

JS Minifier strips comments and tightens spacing around punctuation entirely in your browser — nothing is uploaded to a server. It's string- and regex-aware: it never alters the contents of quoted strings, template literals, or /regex/ literals, so a URL like https://example.com inside a string won't get corrupted the way a naive comment-stripping approach would.

How to use JS Minifier

  1. 1Paste your JavaScript into the input box.
  2. 2Click 'Minify' to strip comments and tighten spacing.
  3. 3Review the result and the characters-saved count below.
  4. 4Click 'Copy' to copy the minified code.

Frequently Asked Questions

Is JS Minifier safe to use with my code?

Yes — comment-stripping and spacing changes skip over string, template literal, and regex contents, so values like URLs inside strings are left intact. Always review and test minified output before deploying it, as with any automated code transformation.

Is JS Minifier free to use?

Yes, it's completely free with no signup required.

Does it rename variables or remove dead code?

No — this is a lightweight text-based minifier that removes comments and unnecessary whitespace, not a full build-tool-grade minifier like Terser or esbuild.

Is my code uploaded to a server?

No, minification happens entirely in your browser.

Tips & Tricks

  • Whitespace inside strings, template literals, and regex literals is preserved exactly as written — only whitespace and comments in actual code get removed or tightened.
  • Spacing is only tightened around punctuation like braces, parentheses, and semicolons — spacing around = and other operators is left as-is.
  • For deeper size reduction (variable renaming, dead-code elimination), use a dedicated build-tool minifier alongside this one.
  • Keep a copy of your original code before minifying, since there's no undo once you navigate away.