Output will appear here...This is a deliberately small JavaScript minifier. It takes one regex pass to drop /* … */ block comments and // line comments, then a second pass to collapse runs of whitespace and trim it from around common operators and punctuation. That is enough to shave 20–40% off most hand-formatted snippets without bringing in a parser or running anything on a server.
What it does not do matters too. There is no AST, so no variable renaming, dead-code elimination or semicolon insertion fixes. Regex literals containing // and template literals with intentional whitespace can occasionally be mangled — always test the output. For production builds, reach for Terser, esbuild or SWC, all of which run on a parsed AST and preserve semantics correctly.
No. It is a fast regex-based pass that strips comments and collapses whitespace — useful for quick prototyping or shaving a few bytes off a snippet. For production code use Terser, esbuild or SWC, which understand the AST and can rename variables, remove dead code and preserve semantics around regex literals and template strings.
It can. Because there is no parser, edge cases like a regex literal containing // or a template literal with significant whitespace can be mangled. Always test the output in a browser before shipping it, or run a real minifier.
Variable renaming requires scope analysis from a real parser. This tool deliberately does the cheapest 80%-of-the-savings transforms only — strip comments, drop whitespace — so it stays small and predictable.
TextEncoder().encode(...).length on the input and output, so it is real UTF-8 byte size — the same number gzip will see before compression. Gzip usually compounds the saving by another 60–80%.
Explore the full suite of Code tools and 290+ other free utilities at Chunky Munster.