How to use it
Paste a page or template and this tool will minify HTML by removing comments, indentation and repeated whitespace, so the same markup ships in fewer bytes. It is careful about the spaces that matter: text and gaps between inline elements stay readable, and pre and textarea content is left exactly as written. Embedded <style>, <script> and JSON-LD blocks are compacted in the same pass, all inside your browser.
How to minify HTML here
- Paste the final, rendered HTML into the input box rather than a server-side template.
- Run the minifier with the "Run tool" button, or press Ctrl + Enter to do the same.
- Compare the size shown under the output with your original.
- Copy or download the result, then load the page once in a browser before deploying it.
What gets removed and what is protected
- Removed: regular comments, line breaks, indentation and runs of spaces. Whitespace next to block-level tags such as
div,liortabledisappears entirely. - Collapsed, not removed: whitespace between inline elements and inside text shrinks to a single space, so words never run together.
- Tidied: extra spaces inside tags, so
<a href = "/">becomes<a href="/">. Quoted attribute values are not modified. - Kept verbatim:
preandtextareacontents, non-breaking spaces, conditional comments such as<!--[if lt IE 9]>and comments starting with<!--!. - Minified as code: inline CSS, inline JavaScript (comments and spacing only, no renaming) and
application/ld+jsonstructured data. Template scripts such astext/templateare left alone, and a block that cannot be parsed is kept as it was.
A before and after you can check
Take a small product snippet written across several lines: a comment <!-- sale price -->, then <div class = "price">, then an indented <span>$49</span> <s>$65</s>, then the closing </div>. The minified version is <div class="price"><span>$49</span> <s>$65</s></div>. The comment and indentation are gone, the attribute is tidied, and the single space between the two prices survives because it is visible on screen. A tool that removed it would print "$49$65".
How much you save depends entirely on the source. In our own test, a 738-character landing page snippet with comments, indentation and an embedded stylesheet came out at 591 characters. Markup that is already compact will shrink far less.
Edge cases worth a second look
| Situation | What can happen | What to do |
|---|---|---|
Boxes laid out with display: inline-block | The line break between two div tags rendered as a small gap; once removed, the boxes touch | Create the spacing with gap or margin |
white-space: pre on a non-pre element | Its spacing is collapsed like any other text | Wrap preformatted text in a real pre |
| Server-side templates | Template tags may not parse as HTML | Minify the rendered output instead |
| Comments used as markers by editors or plugins | The markers are deleted | Minify only what is served, never content you will edit again |
Minification and compression
Minifying does not replace gzip or Brotli on the server; the two stack. Compression already squeezes repeated whitespace well, so the difference over the wire is smaller than the raw numbers suggest. Minification still pays off where compression is missing or limited: single-page landing pages full of inline code, HTML snippets stored in databases, and HTML email, where some clients are commonly reported to clip messages above roughly 100 KB. The trade-offs are covered in what is minification.
Privacy and related tools
The minifier is plain JavaScript running in your tab, so the markup you paste is not sent to the server; only an anonymous usage counter is incremented. To make a minified page readable again, use the HTML beautifier. Standalone scripts can go through the JavaScript minifier, and the rest of the toolbox is under developer tools.