JavaScript Minifier — Lightweight
Shrink small JavaScript snippets for quick sharing or inspection. The tool deliberately stays conservative and labels its output as lightweight rather than replacing a real bundler.
This is a conservative whitespace/comment reducer, not a production bundler or AST minifier. Review code before deployment.
How this tool works
The text pass removes block comments, full-line // comments and selected whitespace around common punctuation. It does not parse a JavaScript AST.
Example
A short multi-line function with comments and spacing becomes a compact one-line representation.
Common questions
Can this safely minify every JavaScript program?
No. Regex-based minification can mishandle edge cases such as regular-expression literals, template strings or unusual comments. Use a real AST minifier for production.
Why include this tool at all?
It is useful for simple snippets, quick payload comparisons and demonstrations where a full build tool is unnecessary.