JavaScript Minifier Online
Minify CSS, JavaScript, HTML or JSON in the browser: strip comments and whitespace, see the size saved instantly.
Processed entirely in your browser — nothing you enter here is ever uploaded.
Result
About this tool
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.
Example. JavaScript const x = 1; /* note */ loses the comment and the extra spaces, and the panel shows the byte size before and after.
Limit. JavaScript names are not shortened; JSON must parse or it is rejected, and HTML leaves pre, textarea, script and style contents untouched.