> html | minify | compress <
// Compress, shrink, and strip whitespace from HTML for faster page loads
Strip Whitespace & Comments
Removes HTML comments and collapses whitespace between tags while preserving content inside pre, textarea, script, and style. Toggle each pass on or off.
Savings Report
Shows original size, minified size, percentage saved, and a visual compression ratio bar so you know exactly how much bandwidth was reclaimed.
Beautify Mode
Re-indent minified HTML for inspection. 100% client-side, browser-based, no upload, your markup never leaves your browser.
// ABOUT HTML MINIFICATION
How HTML Minification Works:
Following the HTML Living Standard (WHATWG), the minifier strips HTML comments, collapses runs of whitespace, and removes whitespace between adjacent tags. Content inside pre, textarea, script, and style is preserved verbatim because it is whitespace-significant. The toggles mirror the html-minifier-terser docs (removeComments, collapseWhitespace) so you can match production build behavior.
Example:
<div> <p>Hi</p> <!-- note --></div> -> <div><p>Hi</p></div>
Common Use Cases:
- >Shrinking server-rendered HTML responses
- >Compressing static site output
- >Inlining email templates
- >Reducing first-paint payload size
- >Cleaning up template artifacts before shipping
>> frequently asked questions
Q: Will minification break my page?
A: For typical HTML, no. The minifier preserves whitespace inside pre, textarea, script, and style blocks, which are whitespace-significant per the HTML Living Standard. Other whitespace between tags is generally not rendered, so collapsing it has no visible effect. If you rely on inline whitespace in inline elements, review the output before deploying.
Q: Are HTML comments removed?
A: Yes when the Remove comments toggle is enabled. Standard HTML comments are stripped. Conditional comments that begin with the legacy IE syntax are left in place. If you depend on build-time comment markers (e.g. SSR placeholders, framework hydration markers), disable the toggle or pre-process those out before pasting your HTML in.
Q: Does it minify inline CSS or JS?
A: No. Style and script tags are preserved as-is to avoid breaking content with regex-based parsing. For deeper compression, run the dedicated JS minifier and CSS minifier separately on those payloads, then inline the minified output. Production tools like html-minifier-terser can recursively minify inline blocks; this tool stays conservative for safety.
Q: Is my HTML uploaded?
A: No, this tool is fully browser-based and runs entirely client-side. The minifier processes your markup in JavaScript using regular expressions in your browser tab. Nothing is uploaded, logged, or sent to a server. The page works offline once it has loaded, so you can paste sensitive markup with confidence.
Q: How much can I save?
A: Pretty-printed HTML typically shrinks 10 to 30 percent after whitespace collapse and comment removal. Combined with gzip or brotli on the server, the on-the-wire savings are even larger because the redundancy patterns minification removes also help compression. The visual ratio bar in this tool shows exactly how much was stripped.