What Minification Does
Minification removes everything that has no runtime effect: comments, unnecessary whitespace, and often optional syntax like trailing semicolons. It's the fastest performance win in any front-end stack — often 20–60% smaller files with zero functionality change.
What This Tool Removes
- HTML — comments, whitespace between tags, redundant spaces in attribute values.
- CSS — comments, whitespace, last semicolons in rule blocks, leading zeros on decimals.
- JS — comments and whitespace (with full string-literal safety: single, double and template quotes are preserved exactly). Variable renaming is not performed — that requires a real minifier like Terser.
What Minification Won't Do
- Rename variables (requires AST parsing)
- Tree-shake unused code
- Dead-code eliminate
- Transform or transpile
- Resolve CSS duplicate rules
For production builds, use the real tooling — Terser for JS, cssnano for CSS, html-minifier-terser for HTML. This tool is for quick one-off minification and byte-savings estimation.
Compression vs Minification
Minification and gzip/brotli compression are complementary. Minification reduces raw bytes; gzip then compresses the minified output. Always do both — minified + gzipped files are typically 15–25% of original size.
Safety Notes
The JS minifier preserves single-quoted, double-quoted and template-literal strings exactly, including escape sequences. Regex literals are treated as code — for regex-heavy code, manually verify output. Always diff before deploying.