Skip to content
Zoyku

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

  1. 1Paste your JavaScript into the input box.
  2. 2The minified output appears instantly, with input/output sizes and the percentage saved.
  3. 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.

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>
100% local processing