Skip to content

HTML Minifier

Minify HTML in your browser: collapse whitespace, strip comments, optionally minify embedded CSS and JavaScript, and see the exact byte savings.

Paste HTML

Options

Minified HTML

Paste HTML, choose options, then minify.

The minified HTML appears here, with exact byte savings.

Limit for uploaded files: 5 MB. Pasted text is not truncated by the tool — your browser’s memory is the ceiling.

Your file is never sent to a server. It is read and processed by your own browser, and the results are not stored.

How to use it

  1. Paste HTML, or choose an .html file.
  2. Choose whether to also minify inline CSS and JavaScript.
  3. Minify, check the byte savings, then copy or download the result.

Limits worth knowing

  • JavaScript and CSS minification are off by default and entirely opt-in.
  • Malformed markup is not repaired. An unclosed tag stays unclosed in the output, so validate the input first.
  • Conditional comments and IE downlevel-revealed content are preserved or removed per the standard rules.
  • Files above 5 MB are refused to keep the tab responsive.

What minification does and does not do

Minification removes bytes that carry no meaning: runs of whitespace, comments, optional closing tags. It does not compress like gzip — the savings are visible and deterministic rather than entropy-based.

Byte counts shown here are exact, so you can decide whether the risk of minifying a legacy template is worth the saving.

When to minify inline assets

If a page inlines a whole stylesheet, minifying it here is almost always safe. If it inlines a hand-written script, minify the script with the JavaScript Minifier first when you want to review the result; this tool uses its own conservative inline transform rather than the same engine.

Frequently asked questions

Does HTML Minifier upload my files to any server?

No. HTML Minifier runs in your browser, and the file is read there rather than sent to a server for processing. Our host still sees ordinary page-request metadata, which is described on the privacy page.

Is HTML Minifier free to use?

Yes, HTML Minifier is free, with no paid tier, no account, and no watermark added to your output. The limits are technical rather than commercial: file size, page count and supported formats are listed on this page.

What file formats and sizes are supported?

HTML Minifier supports .html, .htm, .txt files up to 5MB directly in your browser.

Does it minify inline CSS and JavaScript?

Only if you ask. The JavaScript and CSS checkboxes minify the contents of <script> and <style> blocks in place; leave them off to process HTML only.

Does minification break my markup?

The library tokenises HTML rather than executing it. Whitespace between tags is collapsed safely, and inline elements keep meaningful spacing where the grammar requires it.

How is the saving measured?

Both sizes are measured with TextEncoder, so the reported percentage is honest — not estimated from character count.

Is my file uploaded?

No. Minification runs in this tab; the file stays on your device.