JoyToolsJoyTools

Code Minifier

100% Client-Side Private — Zero Server Uploads

Minify and compress JavaScript, HTML, and CSS code online with Terser engine. Reduce payload size by up to 70%.

🔒 100% Client-Side: All data is processed locally in your browser and never leaves your device (Zero Server Uploads).
E-E-A-T Security Proof →
Interactive Workspace
Language:
Original
0.00 KB
Minified
0.00 KB
Est. Gzip
0.00 KB
Saved
0%
Share & Developer Embed

How do I use Code Minifier?

1

Paste HTML, CSS, or JavaScript source code into the editor or click "Load Sample Data".

2

Select language mode (`Auto`, `HTML`, `CSS`, or `JS`) and toggle comment stripping or whitespace collapse.

3

Inspect the byte reduction metrics and copy or download the minified production output.

What features does Code Minifier offer?

Terser JS minification engine with mangling and dead code elimination

CSS & HTML comment stripping & whitespace collapsing

Live compression ratio & percentage saved metrics

100% client-side privacy guarantee — zero server uploads

Web Asset Minification & Compression Benchmarks

Compares AST token compression ratios before and after Brotli (RFC 7932) transport encoding.

Minification Techniques & Typical Payload Reduction by Asset Type
Asset TypeAST Transformation AppliedRaw Minified SavingsMinified + Brotli-11 Savings
JavaScript (ES2022)Identifier mangling, dead-code elimination, whitespace removal35% – 55%78% – 85%
CSS3 StylesheetsShorthand merging, hex color 6→3 char folding, comment stripping25% – 45%82% – 88%
HTML5 MarkupInter-tag whitespace collapse, optional closing tag removal15% – 30%75% – 84%
Inline SVG inside HTMLPath precision rounding, metadata & XML comment removal40% – 65%80% – 90%

Frequently Asked Questions about Code Minifier

Why does collapsing whitespace in HTML sometimes break inline layout spacing?

HTML treats newlines between inline elements (`<span>`, `<a>`) as a single space character (`U+0020`). Aggressive whitespace collapse removes this gap unless `conservativeCollapse` is maintained around inline display tags.

Are license comments (`/*! ... */`) preserved during CSS and JS minification?

Standard block comments (`/* ... */`) and line comments (`//`) are stripped to save bytes, while legal bang-comments (`/*! ... */`) can be retained depending on your comment preservation toggle.

Can CSS minification break `calc()` expressions?

CSS `calc()` requires explicit spaces around `+` and `-` operators (e.g., `calc(100% - 20px)`) so the parser distinguishes subtraction from negative numbers (`-20px`). Our CSS tokenizer preserves mandatory spaces inside `calc()`, `min()`, `max()`, and `clamp()`.

What is the maximum file size supported for in-browser code minification?

The client-side engine processes files up to 10 MB without server round-trips. Bundles larger than 2 MB execute asynchronously to avoid blocking the browser UI main thread.