Skip to content

HTML Minifier

Lossless compression · report included · 100% client-side

Live

Appearance

Accent color

Font size

Layout density

Preferences are saved on this device for the minifier only.

Safe preset
0 B · 0 lines
Minified output 0 B · 0 lines
0 Bbefore
0 Bafter
0%saved
0 → 0lines

Paste HTML to see savings

Free Forever Up to −30% bytes Lossless output

Minify HTML and ship lighter pages

Strip whitespace, comments, and redundant markup from your HTML — instantly, in your browser. Faster loads, better Core Web Vitals, and a safe margin under Google’s 2MB crawl limit.

10–30%
Typical savings
2 MB
Google crawl cap
0
Bytes uploaded

Under the hood

What minification strips away

Six categories of dead weight — each one invisible to users, all of them bytes on the wire.

−8–15%

Whitespace & indentation

Tabs, newlines, and runs of spaces between tags collapse to nothing — or a single space where semantics require it.

\n \t → nothing
−2–6%

HTML comments

Comments meant for developers never reach users. Stripping them removes dead weight instantly.

<!-- dev note -->
−1–4%

Optional closing tags

Many closing tags are optional in HTML5 — even body and html. Omitting them is valid and smaller.

</li> </p> </td>
−1–3%

Boolean attribute values

The value is implied for disabled, selected, required, and readonly too.

checked="checked" → checked
−1–2%

Default attributes

Spec-implied attributes on inputs, scripts, and forms can all be removed.

type="text" · method="get"
−1–3%

Empty elements & quotes

Quotes around safe attribute values can drop, and redundant protocol URLs can go relative.

class="x" → class=x

See it work

Same page, 43% fewer bytes

Identical rendering in every browser — the only difference is what travels over the network.

Original 212 B · 11 lines
<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Page metadata -->
    <title>My Page</title>
  </head>
  <body>
    <h1 class="title">Hello</h1>
  </body>
</html>
Minified 121 B · 1 line
<!DOCTYPE html><html lang="en"><head><title>My Page</title></head><body><h1 class="title">Hello</h1></body></html>

Real-world numbers

Typical savings by page type

CMS-built and template-heavy pages carry the most dead weight — and save the most.

Typical blog page 48 KB → −22%
Ecommerce product page 96 KB → −18%
Documentation article 64 KB → −26%
Landing page (CMS-built) 140 KB → −31%

Representative ranges from real-world markup — your mileage varies with template quality.

How to use

Four steps to a lighter page

01

Paste your HTML

Drop a full document or a partial fragment into the input — templates, CMS output, or hand-written markup all work.

02

Pick your options

Toggle comment removal, whitespace collapsing, optional tag omission, and attribute simplification to taste.

03

Review the savings

See before/after byte counts and compression ratio instantly. The minified output updates as you type.

04

Copy or download

Grab the compressed HTML for deployment — and keep your readable source as the version you edit.

SEO impact

Why byte-shaving is an SEO move

Minified HTML won’t rank you #1 — but it removes real technical friction from crawling and rendering.

LCP ↓

Core Web Vitals

Smaller HTML reaches the browser sooner, so your largest contentful paint fires earlier — a direct input to Google’s page-experience signals.

2 MB

Google’s 2MB crawl cap

Googlebot now ignores HTML past a 2MB threshold. Minification keeps bloated templates safely under the limit so nothing gets truncated.

−20%

Bandwidth & crawl budget

Leaner pages mean faster crawls and cheaper delivery — Googlebot fetches more of your site per visit, and CDN bills shrink at scale.

Compare

Minify vs. gzip vs. Brotli — you need all three

They solve different problems and stack multiplicatively.

Technique How it works Typical gain Where it happens
Minification Rewrites the source — strips characters 10–30% smaller Before sending, at build time
Gzip Compresses bytes on the wire (DEFLATE) 60–80% smaller Server → browser, transparent
Brotli Newer compression with a web dictionary 70–85% smaller Server → browser, HTTPS only

FAQ

Minification questions, answered

What does an HTML minifier actually remove?

Everything the browser doesn’t need: indentation, line breaks, comments, optional closing tags, default attribute values, boolean attribute values, and redundant quotes. The rendered page is identical — only the bytes change. Think of it as lossless compression of your source code, not your content.

Can minification break my page?

Rarely, if done correctly. The edge cases: <pre> and <textarea> content is whitespace-sensitive and must be preserved; inline CSS and JavaScript need their own minifiers; and old conditional comments (<!--[if IE]>) can matter on legacy sites. A good minifier handles all three automatically — this one does.

If my server uses gzip or Brotli, is minifying still worth it?

Yes — they stack. Compression algorithms work better on already-clean input, and minification removes bytes that compression can only shrink, not delete. Minify HTML typically saves another 5–10% after gzip. Also, minified source helps non-HTTP contexts: email, embedded viewers, and saved pages.

How much smaller will my HTML get?

Typically 10–30%, depending on how the markup was written. CMS-generated and page-builder HTML with heavy indentation and comment soup sees the biggest wins; hand-tuned markup less so. The tool shows exact before/after byte counts so you never have to guess.

Does minified HTML help SEO?

Indirectly but measurably. Smaller HTML improves LCP and time-to-first-byte, keeps you safely under Googlebot’s 2MB crawl cap, and reduces crawl cost on large sites. It’s one of the cheapest page-speed wins available — no rendering behavior changes at all.

Should I edit the minified version afterwards?

No — always keep your readable source as the editable version and treat minified output as a build artifact. Minify at deploy time (or paste through this tool), ship the compressed copy, and iterate on the original. Editing minified HTML is a one-way door to merge conflicts and pain.

Is my code uploaded to a server?

Never. All minification runs locally in your browser — unreleased templates, proprietary markup, and internal tooling code stay on your device. Nothing is logged, stored, or transmitted, and the tool keeps working offline.

212 B → 121 B · still valid HTML5

Every byte you don’t send is free speed

Paste your markup above — instant compression, live savings report, zero uploads.