HTML Minifier
Remove comments, collapse whitespace, drop optional tags and shorten attributes. The byte counts are measured on the UTF-8 encoded input and output.
What gets minified
This tool runs the plugins from rehype-preset-minify with the preset's serializer settings: comments are removed, whitespace between elements is collapsed, optional tags such as </p> and <head> are omitted, attribute quotes are dropped where HTML allows it, duplicate class names are removed, type="text/css" and type="text/javascript" are dropped, and CSS inside <style> and style attributes is minified with clean-css.
Browser limitation, stated plainly
Three plugins of the preset are not run here: rehype-minify-javascript-script, rehype-minify-javascript-url and rehype-minify-event-handler. They depend on uglify-js, which needs Node.js and code evaluation that this site's security policy does not allow. Inline JavaScript is therefore left as is. When you run rehype-preset-minify in Node.js or with rehype-cli, all 23 plugins run.
Read the savings correctly
Savings are computed as input bytes minus output bytes, both measured as UTF-8. Minified HTML is meant for machines: it is valid HTML, but it is harder to read and diff. Keep your formatted source and minify as a build step. Already-minified input may save nothing, and the tool reports that rather than claiming an optimization.
Packages used
rehype-parse, rehype-preset-minify (20 of 23 plugins), rehype-stringify, bundled locally from npm and run in a Web Worker. Your input stays on your device.
Other tools: HTML Formatter · HTML Sanitizer · HTML to Markdown · HTML Playground · Plugin Explorer