JavaScript Minifier Online
Minify CSS, JavaScript, HTML or JSON in the browser: strip comments and whitespace, see the size saved instantly.
Result
This page opens the code minifier with JavaScript preselected. It performs safe, conservative minification: comments and unnecessary whitespace are removed, but nothing is renamed and no expressions are rewritten — the output is functionally identical to the input, just smaller.
The scanner understands JavaScript syntax where it matters for safety: string literals, template literals (including nested ${} expressions) and regex literals are detected and copied verbatim, and newlines are kept wherever automatic semicolon insertion could change the meaning of the code. That makes this minifier a safe quick step for inline scripts, code snippets for blog posts, bookmarklets or email templates where a full build pipeline is overkill.
Comment-heavy, well-formatted source typically shrinks by 20–40%. If you need maximum compression with variable renaming and dead-code elimination, use a build-time tool like Terser; if you need readable code back, that is the opposite job — done by our code formatter, not this tool.