Code Minifier

Minify JavaScript, CSS or HTML: strip comments and unnecessary whitespace and see the original size, the minified size and the savings.

Your code never leaves your browser. No uploads, no tracking, all local.

Original size: 0 B
Minified size: 0 B
Savings: 0%

How It Works

Paste your code, pick the format, and press Minify. The tool strips comments and unnecessary whitespace entirely in your browser and shows you the original size, the minified size, and the savings percentage.

What gets removed?
JavaScript: line comments (//) and block comments (/* */). CSS: block comments (/* */) and redundant whitespace. HTML: comments and blank lines between tags. Whitespace that carries meaning inside string literals is preserved.
Why is it called conservative?
It never renames variables, shortens identifiers, or rewrites expressions — that is what heavy minifiers like Terser do, and it requires a full parser plus scope analysis. This tool uses simple string-level processing (a small state machine for strings, comment removal, whitespace collapsing), so it stays zero-dependency and transparent. The result is guaranteed smaller than your source, but not guaranteed to be the smallest possible.
Should I trust the output blindly?
It handles the common cases safely, including comment-like text inside strings. But edge cases exist (unusual regex literals, odd HTML embedded in JS). Diff the output against the original and run your tests before deploying — the savings numbers are informational, not a substitute for verification.

Frequently Asked Questions

Which formats can I minify?

JavaScript, CSS and HTML. Pick the format before minifying so the tool knows which comment syntaxes and whitespace rules to apply. JavaScript line comments (//) and block comments (/* */), CSS block comments, and HTML comments are all removed, along with unnecessary whitespace.

Is the minifier as small as Terser or UglifyJS?

No, and it does not aim to be. This is a conservative, zero-dependency minifier: it strips comments and redundant whitespace without renaming variables, shortening identifiers, or analyzing the code. Expect solid savings from removing comments and blank lines, not maximum possible compression. For production builds, run a real bundler/minifier afterwards.

Can it break my code?

The tool is careful not to touch comment-like text inside string literals — "// not a comment" in JavaScript stays intact. That said, no lightweight tool can parse every edge case (regex literals containing quotes, unusual HTML inside JS templates, and other oddities). Always diff the output and test it before shipping.

Does my code get uploaded anywhere?

No. Everything runs locally in your browser with zero uploads and zero tracking. Your code never leaves the page — not to a server, not to an ad network, nowhere.

Why does the savings percentage differ between formats?

It depends on how much removable content your source contains. Code with many comments and blank lines shrinks the most; already-dense code shrinks less. CSS often saves more than JS because whitespace around braces, commas and colons is purely cosmetic there, while JS whitespace is sometimes load-bearing.