HTML Minifier Details
HTML Minifier strips redundant whitespace and comments out of HTML to make the file smaller.
Use it to cut the size of a template before shipping, fit email HTML under a limit, or squash a fragment onto one line.
Step by step
Short version: give it input, run it, take the output. Details below.
- Paste the HTML into the box.
- Run the tool; comments and extra whitespace are removed.
- Copy the result and ship it.
Technical details
Minification behaviour:
- Block comments are removed and runs of whitespace collapse to a single space.
- Whitespace around braces, colons, semicolons, commas and greater-than signs is dropped.
- The code is processed in your browser, never uploaded.
- The result is close to a single line; readability is not the goal.
Picking the right tool
This page is about size. To go the other way and make code readable, use the HTML Beautifier.
This is a text-level minifier: content inside whitespace-sensitive tags such as pre and textarea can be altered, so check the output before shipping. Single-line comments inside inline script can swallow the code after them.
Practical notes
- Keep a copy of the original — editing minified output is painful.
- Always verify pages containing pre or textarea in a browser afterwards.
- Most of the real saving comes from server compression (gzip, brotli); treat minification as an addition to it.
Where your data is processed
The work happens locally and your data stays on the device. The single outgoing request is the usage counter, and your text is not part of it. Advertising and measurement cookies operate at page level, never inside the tool.