How the HTML Minifier Works
AnyTool minifies HTML with an AST-based engine (html-minifier-terser) that delegates inline JavaScript to terser/Oxc and inline CSS to clean-css. It collapses whitespace, removes comments and optional/redundant attributes, and optionally minifies inline styles and scripts, while safely preserving whitespace-sensitive tags such as pre, code, textarea, script, and style. Safe/Balanced/Aggressive presets and granular toggles control the output, and original, minified, and gzip sizes (via CompressionStream) update live.
- AST-based engine, not regex
- Minifies inline CSS and JavaScript
- Preserves pre/code/textarea/script/style content
- Safe/Balanced/Aggressive presets plus granular options
- Live original, minified, and gzip size stats
