HTML Minifier

Strip redundant whitespace and comments from HTML to shrink the file, all inside your browser.

The output will appear here.

How HTML Minifier works

Strip redundant whitespace and comments from HTML to shrink the file, all inside your browser.

Input HTML
Output Minified HTML
Works done 5,301

Related tools

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.

  1. Paste the HTML into the box.
  2. Run the tool; comments and extra whitespace are removed.
  3. 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.

Frequently asked questions

Type or paste your data into the HTML field, run the tool, then copy or download the Minified HTML result.

Yes. While the text field is focused, Ctrl + Enter (Cmd + Enter on macOS) runs the tool.

You can copy the output or save it as a text file with the download button. The file name is based on the tool name.

The tool shows the error message in the output area. Fix the input and run it again.