JavaScript Minifier
A conservative JavaScript minifier: strips comments and collapses blank lines, keeping line breaks — no risky rewrites, your code semantics stay untouched.
This tool runs entirely in your browser. Your data never leaves your device — it is not uploaded to any server.
How to use
- 1Paste your JavaScript into the input box.
- 2The minified output appears instantly, with input/output sizes and the percentage saved.
- 3Copy the compact script or clear the input to minify another file.
JavaScript Minifier
This minifier does exactly two things: it removes // and /* */ comments (even inside gnarly files — strings, template literals including nested ${…} and regex literals are respected), and it collapses blank lines and indentation. Line breaks between statements are preserved, so automatic semicolon insertion keeps working exactly as before.
It will never rename variables, inline code or merge statements — that is the job of a full build tool. What you get is a meaningfully smaller, safely minified file plus a live byte-savings readout, entirely in your browser.
Frequently asked questions
Why does it keep line breaks instead of joining everything into one line?
Deliberate choice. JavaScript relies on automatic semicolon insertion, and removing newlines can silently change what a program does. Keeping line breaks makes this minifier safe for code that never goes through a real bundler.
How is this different from Terser or UglifyJS?
Those parse and rewrite the AST: mangling names, removing dead code, inlining. Much smaller output, but a real build step. This tool only removes comments and blank lines — zero risk of behavior change, no build required.
Is my code uploaded anywhere?
No. Everything runs locally in your browser — your source never leaves the device.
Related tools
CSS Minifier
Minify CSS online: remove comments and needless spaces to cut stylesheet size for faster loads. Instant, private, and safe for your rules.
All tools →
HTML Minifier
Minify HTML in your browser: strip comments and collapse whitespace to cut page weight — a conservative cleaner that keeps your markup and rendering intact.
All tools →
JSON Minifier
Minify JSON online: strip all whitespace to shrink payloads for faster API responses and smaller storage — see the exact bytes saved, privately in your browser.
All tools →
Regex Tester
Test regular expressions live: highlight every match as you type, inspect capture groups and debug patterns for JavaScript, with common flags one click away.
All tools →
Embed this tool
Put this tool on your own site with one line — it runs entirely in the visitor's browser.
<iframe src="https://zoyku.com/en/tools/javascript-minifier?embed=1" width="100%" height="640" style="border:0;border-radius:16px" title="Zoyku — javascript-minifier" loading="lazy"></iframe>