๐Ÿ—œ๏ธ HTML Minifier

Before: 61 bytesAfter: 54 bytesReduction: 11.5%

Strip comments and unnecessary whitespace/line breaks from HTML code to reduce its file size. Shows the byte size before and after, plus the percentage reduction, so you can see exactly how much lighter it got.

How to use

  1. Enter the HTML code you want to minify.
  2. The minified result appears automatically, along with the before/after size and reduction percentage.
  3. Use the "Copy" button to copy the minified result.

FAQ

Does this collapse whitespace inside <pre> tags too?

This tool does simple whitespace collapsing, so meaningful whitespace inside a <pre> tag may get collapsed as well. Use caution with HTML that contains preformatted text.

Does this also minify the JavaScript or CSS code itself?

No โ€” code inside <script> or <style> tags isn't itself minified (no variable renaming, etc.). Only whitespace and comments between HTML tags are targeted.

Can I un-minify the result afterward?

Minifying itself has no built-in undo, but you can use our HTML Formatter to reformat it into readable code again.