Why this doesn't squash everything onto one line
JavaScript has a feature called automatic semicolon insertion that can silently change what your code does if lines get joined together without care - a safe general-purpose minifier needs to actually parse the syntax to avoid that trap, not just push text around with regular expressions. This tool strips comments and trims extra whitespace, which is genuinely safe to do blindly, and deliberately leaves line breaks alone rather than risk that class of bug.
What it safely removes
Single-line and block comments are stripped entirely, and leading/trailing whitespace on each line is
trimmed - both changes that can never alter what the code actually does, since comments have no runtime effect
and whitespace outside of strings is never semantically meaningful in JavaScript. The minifier carefully tracks
whether it's currently inside a string or template literal so it never accidentally strips something that
merely looks like a comment inside quoted text. It also recognises when a / opens a regex literal
rather than division or a comment, so patterns like /^https?:\/\// survive intact instead of being
mistaken for the start of a comment.
What a real production minifier does that this doesn't
Tools like Terser or esbuild parse your code into a full syntax tree, which lets them safely rename local variables to shorter names, remove genuinely dead/unreachable code, and join lines together with full knowledge of exactly where that's safe to do - none of which a regex-and-string-scanning approach like this tool's can do reliably. For an actual production build pipeline, use one of those real tools; this one is for a quick, safe size reduction on a snippet you're sharing or testing.
The savings percentage shown
After minifying, the tool reports exactly how many characters were removed as a percentage - useful context for understanding that comment-and-whitespace stripping alone, while completely safe, achieves meaningfully less size reduction than a real syntax-aware minifier would on the same code.