Skip to main content
{/}codefunc
Minifiers & TextRuns locally

HTML Minifier

Minify HTML by removing whitespace and comments.

About this tool

Minify HTML by removing whitespace and comments. Quick payload size checks, text cleanup, and deploy prep during development.

Paste the HTML you want to shrink for transfer or embedding. Minify to strip comments and redundant whitespace. Example — Collapse padded markup: try `<div> <p>Hi</p> </div>` and expect something like `<div><p>Hi</p></div>`.

Aggressive whitespace removal can break <pre>, inline JS string literals, or significant spaces. See also: HTML Beautifier, CSS Minifier, and SVG Optimizer. Runs in your browser — nothing you paste gets uploaded.

How to use

  1. Paste the HTML you want to shrink for transfer or embedding.
  2. Minify to strip comments and redundant whitespace.
  3. Compare byte size before shipping static snippets or email templates.
  4. Keep a beautified source in git; minify as a build or publish step.

Example

Collapse padded markup

Input

<div>  <p>Hi</p>  </div>

Output

<div><p>Hi</p></div>

Limitations

  • Aggressive whitespace removal can break <pre>, inline JS string literals, or significant spaces.
  • Does not tree-shake unused CSS/JS referenced by the markup.
  • Not a full HTML optimizer with critical-CSS extraction.

Related tools

3

Frequently asked questions

What does the HTML Minifier do?

Minify HTML by removing whitespace and comments. Runs in your browser — no install, no account.

How do I use the HTML Minifier?

Paste the HTML you want to shrink for transfer or embedding. Minify to strip comments and redundant whitespace. Compare byte size before shipping static snippets or email templates. Keep a beautified source in git; minify as a build or publish step.

Is the HTML Minifier free?

Yes. No signup, no usage limits, no paywall.

Does the HTML Minifier upload my data?

No. Processing happens locally in JavaScript. Your input is not uploaded, stored, or logged.

What are the limitations of the HTML Minifier?

Aggressive whitespace removal can break <pre>, inline JS string literals, or significant spaces. Does not tree-shake unused CSS/JS referenced by the markup. Not a full HTML optimizer with critical-CSS extraction.

Search tools

Find a developer tool